2

Working with SharePoint 2013 onPremise here. And it is driving me nuts :-(

i have a custom list with attachments and Likes enabled. And I want to retrieve both via REST - which seems impossible if I also want to $select only a certain set of fields

First, the listdata.svc: Its great, I can select sub-properties of linked lists, I can expand and select Attachments and filter on all of this, like

?$expand=ContactTags,StoryTags,TopicTags,Attachments&$select=Id,Title,Overview,PoV,Overview_CP,Overview_EN,Overview_FI,Overview_HC,Overview_IG,Overview_INS,Overview_PI,Overview_PS,Overview_TMT,ContactTags/Id,StoryTags/Id,TopicTags/Id,Attachments,Modified&$filter=

BUT adding LikesCount (or simply trying LikesCount alone for simplicity):

_vti_bin/listdata.svc/Topic_DB?$select=LikesCount

results in

Type 'Microsoft.SharePoint.DataService.Topic_DBItem' does not have a property named 'LikesCount'."

Its already apparent when not specifying any query options at all, no social fields are returned by the listdata.svc

On the other hand, looking at _web/api/

_api/web/lists/getbytitle('Topic_DB')/Items/?$select=LikesCount

does return the expected field! But as mentioned, I want more. Attachments for example:

_api/web/lists/getbytitle('Topic_DB')/Items/?$expand=AttachmentFiles&$select=AttachmentFiles

but guess what?

{
  "error": {
    "code": "-2147024809, System.ArgumentException",
    "message": {
      "lang": "en-US",
      "value": "Value does not fall within the expected range."
    }
  }
}

The only way to get Attachment details AND LikesCount seems to be to go with _web/api/lists and no $select at all? Huge waste of bandwidth with all the unneeded data and metadata returned.

Any hints on listdata.svc and social content?

  • maybe try using "/_vti_bin/listdata.svc/Topic_DB" without filter to check whether LikesCount field is in the returning data schema. I noticed sometime the field name are different in these two approaches. – Shawn Feb 9 '16 at 23:26
  • unfortunately it does nto show up in the unfiltered response, so its apparently not available in the listdata.svc :-( – Jens Feb 12 '16 at 12:11
  • I always thought there was a simpler side-by-side comparison for _vti_bin/ListData.svc and _api/web – Aamir Jun 14 '16 at 13:09

Your Answer

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

Browse other questions tagged or ask your own question.