Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I want to query a links list using ListData.svc and have this ordered, using the query string $orderby, by Sharepoint's own internal order field.

By internal order field I specifically mean the field that is updated by the Reorder.aspx page in Sharepoint.

If I dump the entire links list by querying with ListData.svc with no options then I cannot see an order field nor anything that resembles one.

If I simply try $orderby=Order then I receive the error "No property 'Order' exists in type".

Is there a way to expose this internal order field to ListData.svc?

share|improve this question
    
can you show to us an example? –  Salvatore Di Fazio Jun 6 '12 at 16:43
    
Sure, here is a pastebin of the xml output from a ListData.svc query, with no additional arguments, of a OOTB Sharepoint links list called "test". In the Sharepoint list the 2nd item "msn.com" is actually ordered above "ea.com" using the "change item order" feature. –  Derek Jun 6 '12 at 17:58
    
did you try to "orderby" title or another column? –  Salvatore Di Fazio Jun 7 '12 at 6:33

1 Answer 1

It does not seem possible to retrieve Order field using SharePoint 2010 REST Interface.

As an alternative approach you could leverage SharePoint Web Services, in particular Lists.GetListItems Method to return list items based on the specified query

The following example demonstrates how to retrieve ordered list items using SPServices library:

var listName = "Links";
$().SPServices({
    operation: "GetListItems",
    listName: listName,
    CAMLQuery: '<Query><OrderBy><FieldRef Name=\"Order\" /></OrderBy></Query>',
    completefunc: function (xData, Status) {
      $(xData.responseXML).SPFilterNode("z:row").each(function() {
        var linkUrl = $(this).attr("ows_URL");
        console.log(linkUrl);
      });
    }
  }); 

SPServices library abstracts SharePoint's Web Services and makes them easier to use in JavaScript.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.