0
votes

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.

2

2 Answers

2
votes

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
0
votes

@Gautam Sheth -

Thanks for your reply. Above call is giving list of all files and link to get metadata for each file (instead of metadata itself). Here we again need to call individual endpoint to get exact metadata.

   "value": [
    {
        "odata.type": "SP.File",
        "odata.id": "file 1 path')",
        "odata.editLink": "file 1 pat')",
        "[email protected]": "file 1 path/ListItemAllFields"
    },
    {
         "odata.type": "SP.File",
        "odata.id": "file 2 path')",
        "odata.editLink": "file 2 path')",
        "[email protected]": "file 2 path/ListItemAllFields"
    }