Reputation: 203
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.
Upvotes: 0
Views: 1701
Reputation: 203
@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"
}
Upvotes: 0
Reputation: 2490
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
Upvotes: 3