SharePoint Graph API GET list of items in drive with expanded driveItem description

325 Views Asked by At

We have an application that shows a list SharePoint documents in a given document library and folder. Is there a way to get a list of documents in a folder, with the Description metadata value? Feels like it should be easy enough to do. Here is a summary of what I've tried so far. Thanks for any help.

Getting the list works fine, using...

https://graph.microsoft.com/v1.0/drives/{driveId}/list/items?expand=driveItem(select=name,id,description)

...but that lists all the items in the {driveId}.

I can limit the result by using a {folderPath}, but that does not support the expand= option, which means I can't get the Description value...

https://graph.microsoft.com/v1.0/drives/{driveId}/root:/{folderPath}:/children

Adding a filter= option is accepted by the API call, but answers the full unfiltered list...

https://graph.microsoft.com/v1.0/drives/{driveId}/list/items?expand=driveItem(select=name,id,description)&$$filter=parentReference/id eq '{folderId}'

I can use a query, but I have not been able to include the Description metadata value in the result. And it only supports delegated permissions, but need to use application permissions. This gives the correct result, minus the Description value...

https://graph.microsoft.com/v1.0/search/query
{
    "requests": [
        {
            "entityTypes": [
                "driveItem"
            ],
            "query": {
                "queryString": "isDocument=true AND path:\"{document path}""
            }
        }
    ]
}
1

There are 1 best solutions below

0
Bob Nemec On

Got this reply from Microsoft on the learn.microsoft.com site...

Currently Graph still not support to expand properties for a list of items. We can only get the item by id and expand for more details like following api

GET /drives/{drive-id}/items/{item-id}?$expand=activities

I feel regretful to inform you that it turns out to be a by-design one. And I noticed that some end users have also proposed the same request, it is highly recommended that you can vote this ticket. Many features of our current products are designed and upgraded based on customers’ feedback. With requirements like this increase, the problem may well be released in the future. Thanks for your understanding.