SharePoint 2010 list items: re-ordering.

Oh how I have missed you SharePoint. In my past as a Software Engineer, I had a nice experience with helping deploy SharePoint 2003 and developed a little bit for that platform and for SharePont 2010. Recently, I’ve been helping with setting up a projects list which a project manager users to prioritize on SharePoint. A custom list was created and of course, the need to reorder an item came up. Unfortunately, it’s not easy to reorder a list through the browser. Here is a possible solution…

One way proposed was to add another column in that is numeric and sort by that. The downside to this is you may end up with duplicate numbers in a row or it’ll take the user a long time to make sure the numbers are unique.

Another way is to enable ordering on a custom list and have UI set up so a user can just re-assign numbers and it’ll update the rest of the order numbers on the other items. This is what I implemented and hopefully the steps I took below will help someone else trying to do the same thing. I have also included resources I’ve used to do this and it is the best from all the sources:

Enabling “Order” on a list…

Edit the Manifest.xml file

  • Create a custom list and from the list settings, save it as a template
  • You should then have the option to visit the template gallery (/_catalogs/lt/forms/allitems.aspx) – download the template (.stp) file.
  • Change the .stp extension to .cab. Double click the renamed file to extract the Manifest.xml file.
  • Open the .xml file in WordPad and add in a new attribute of OrderedList=True to the List tag in the UserLists section and then save the file.

 

 

 

Repackage and upload it to SharePoint

  • Windows comes with a utility called makecab and we’ll use this to repackage the .xml file into it. Create a new folder and copy/move the Manifest.xml file into it.
  • Create a new text file and save it as files with a .ddf extension (e.g. files.ddf) into the folder you just created.
  • Open up files.ddf and put in the following text and save it:

.OPTION EXPLICIT
.Set CabinetNameTemplate=newtemplate.stp
.set DiskDirectoryTemplate=CDROM
.Set CompressionType=MSZIP
.Set UniqueFiles=”ON”
.Set Cabinet=on
.Set DiskDirectory1=.
.Set CabinetFileCountThreshold=0
.Set FolderFileCountThreshold=0
.Set FolderSizeThreshold=0
.Set MaxCabinetSize=0
.Set MaxDiskFileCount=0
.Set MaxDiskSize=0

manifest.xml

 

  •  Load up the command prompt and go to the folder run “makecab /f files.ddf” to execute makecab.
  • You should now have a .stp file listed as newtemplate.stp.
  • Go to your template gallery in SharePoint and upload the .stp file so you can create a  custom list with ordering enabled!

 

 

 


Testing if ordering is enabled

  • Create a new custom list using the new template you uploaded.
  • You can get to the re-order feature by using ” /_layouts/Reorder.aspx?List={ListId}” (e.g. List=7B2350570E-7F4E-4612-B08F-3A5B117A5AFA).

If everything checks out, then users can now re-order a list! To make it more convenient, you should add in a Custom Action which links to the reorder.aspx page dynamically…

 Custom Action

Instead of having the user go type in the URL to get to the redorder.aspx page, it would be more convenient to have the action available through the list itself as depicted below…

 

 

 

Fortunately, you can put in a custom action via SharePoint Designer! Just load the application up and open up the list. On the top left you should see an option to create a Custom Action or you can also do it on the bottom right. The key here is to put in the following in the Navigate to URL section: {SiteURL}/_layouts/Reorder.aspx?List={ListId}

 

 

 

 

 

 

 

And that’s it! Here are some additional resources as well:

SharePoint CommandUIHandler Element Attributes
http://msdn.microsoft.com/en-us/library/ff458385.aspx

Enable Ordering of a SharePoint List
http://sharepointjim.wordpress.com/2012/05/10/how-to-enable-list-item-re-order-in-any-sharepoint-2010-custom-list/

Repackage SharePoint STP Files
http://blog.dennus.net/2011/05/17/modify-and-repackage-sharepoint-stp-files/

SharePoint List Custom Actions
http://sangeetahuja.com/re-order-list-items-feature/

 

Leave a Reply