I'm using the /_vti_bin/listdata.svc endpoint in the SharePoint 2010 REST API to update file metadata. At the moment I'm referencing the file by ID, but I'd like to use the file's path or filename instead.

Is there a method I can use to reference a file directly by it's path, similar to getFileByServerRelativeURL() from SharePoint 2013 onwards?

  • are you using javascript or C#? – Mike Mar 13 '17 at 1:20
  • Neither - I'm making direct HTTP requests to the REST API. – Jonathan Holvey Mar 13 '17 at 7:12

You can use $filter query string and a property called "Name" like

/_vti_bin/Listdata.svc/myList()?$filter=Name eq 'Task3'

to get only the item which has its name as 'Task3'

| improve this answer | |
  • That's not to grab the file, but a list item. – Mike Mar 13 '17 at 14:56
  • I tried this and it does also work for libraries, where Name refers to the filename. – Jonathan Holvey Mar 14 '17 at 0:39

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.