1

what I'm currently doing is accessing the files in my Document Library through the REST API like this: [baseURL]/_api/Web/GetFileByServerRelativeUrl('[relativeURL]'). To collect these relativeURLs, I first need to crawl through the directories first, which is quiet clumsy.

I've noticed that there's also an option to access them through the GUID: [baseURL]/_api/Web/GetFileById('[guid]'). However this doesn't seem much easier.

I've noticed that every file gets assigned a numerically index ID by default. E.g:

enter image description here

Is there a way to access the files through this ID column via the REST API?

1 Answer 1

0

To query list items by ItemId, use REST API endpoint such as this:

/_api/web/lists/getByTitle('List Name')/items(" + ItemId + ")
1
  • Oh, I was under the impression that SharePoint considers Document Libraries as something completely different than Lists and as such this method of access was not available.
    – nanoxid
    Commented Feb 14, 2022 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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