Search code examples
sharepointsharepoint-2010dynamics-crmsharepoint-api

Sharepoint - how to get metadata for multiple files


Using below sharepoint Endpoint we can fetch the metadata for specific file. GET https://domain.example.com/_api/web/GetFileByServerRelativeUrl(URL)/ListItemAllFields

Is there any way using which we can fetch metadata of all files from particular folder?

In above case we need to give multiple call if we need to fetch metadata for more than one file. SO trying to find out if we can fetch metadata for multiple files in one call.


Solution

  • You can use getFolderByServerRelativeUrl endpoint to fetch the files and the associated metadata as below in a single call :

    https://<your-site>/sites/test/_api/web/getFolderByServerRelativeUrl
    ('/sites/Test/Documents/FolderName/')/Files?$select=ListItemAllFields/*
    &$expand=ListItemAllFields