3

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?

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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