2

I use .../lists/getbytitle('rootFolderName')/items(11575) (where 11575 is the id of a file) to update the data of a file and it works fine. Now, I want to call this for all files inside a folder. So I thought I try to get all their IDs and then I would run this in a loop.

I tried .../GetFolderByServerRelativeUrl('DocLib/FolderName')/Files but the ids that it returns are like

<entry>
<id>Web/GetFileByServerRelativeUrl('.../DocLib/FolderName/_DSC5603.jpg')</id>
...
</entry>

Which is correct but I would expect an integer, like 11575. Is there any way to get the IDs of those files? If this isn't possible, can I find this information from the database maybe?

1
  • you need to expand fields as shown below .../GetFolderByServerRelativeUrl('DocLib/FolderName')/Files?$select=*,ListItemAllFields/Id,ListItemAllFields/Created,FileRef&$expand=ListItemAllFields Jan 24 '17 at 10:18
4

Try it as below:

/_api/web/getfolderbyserverrelativeurl('DocLib/FolderName')/Files?$expand=ListItemAllFields
2
  • Can't I get all ids with one call? If I were to use ListItemAllFields I would have to first find all filenames of the folder's files, I guess I can do that but that's an extra step.
    – 8odoros
    Jan 24 '17 at 10:22
  • Yep, try edited code Jan 24 '17 at 10:25

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.