SharePoint 2013: Enable ‘Change Item Order’ Ribbon Action

One of my customer migrated their SharePoint environment from MOSS 2007 to SharePoint 2013.
Problem: After successful migration, they came to know that they were no more able to change any items order of “Links” list.
So they reported an issue where a “Links” list does not have an option “Change Item Order” (it was available in MOSS 2007) available/enabled in “Actions” tool of Ribbon.
Findings: When creating a new Links list in SharePoint 2013 they would have this (“Change Item Order”) available/enabled in Ribbon. Based on this it is confirmed that it is not related to Site or Site Collection Features. Creating new views in the migrated list showed the same result (“Change Item Order” not available in Ribbon).
So it is confirmed, this is related to some features which are not available after migrating a MOSS 2007 Site to SharePoint 2013. After doing some research on “How change item order work” – come to know that SharePoint utilizes hidden column “order” to established the purchase. Once we select the “Change Item Order” choice, SharePoint utilizes “/_Layouts/Reorder.aspx?List=ListGUID” web page to reorder the listing products.
It is not possible to change this through SPView.OrderedView because it is read-only.

There are distinct methods we are able to use to enable this characteristic for lists. I have used the best one with PowerShell Script as below:

# Add “Change Item Order” button at target List
$siteUrl = “yourSiteCollectionUrl”;
$listTitle = “yourListTitle”;
$site = Get-SPSite -Identity $siteUrl;
$web = $site.OpenWeb();
$list = $web.Lists[$listTitle];
$list.UserCustomActions.Clear();
$action = $list.UserCustomActions.Add();
$action.Location = “CommandUI.Ribbon”;
$action.Sequence = 85;
$action.Title = “PS.OrderItems”;
$action.CommandUIExtension =
[string]::Format(
“<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location=””Ribbon.ListItem.Actions.Controls._children””>
<Button Id=””ReOrderAction.Button”” TemplateAlias=””o1″”
Command=””ReOrderCommand”” CommandType=””General””
LabelText=””Change Item Order””
Image16by16=””/_layouts/1033/images/formatmap16x16.png””
Image16by16Top=””-192″” Image16by16Left=””-144″”
Image32by32=””/_layouts/1033/images/formatmap32x32.png””
Image32by32Top=””-192″” Image32by32Left=””-288″”/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command =””ReOrderCommand””
CommandAction=””{0}/_layouts/reorder.aspx?List={1}”” />
</CommandUIHandlers>
</CommandUIExtension>”,
$web.ServerRelativeUrl.TrimEnd(‘/’), $list.ID);
$action.Update();
$view = $list.DefaultView;
$view.Query = [string]::Format(“<OrderBy><FieldRef Name=””Order””
Ascending=””TRUE””/></OrderBy>”);
$view.Update();
Write-Host “————————————-”
Write-Host “Change item order button added successfully for
the list :  ” $list.Title -foregroundcolor Green -nonewline
Write-Host ” in the site  : ” $site.Url -foregroundcolor Green
Write-Host “————————————-”
$web.Dispose();
$site.Dispose();

Note: Replace Site URL and List Title as per your requirement. This script will work for any list to have “Change Item Order” feature available in Ribbon.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s