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

Bob Nemec 20 Reputation points
2023-11-22T17:35:23.2133333+00:00

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 ... with body

{
    "requests": [
        {
            "entityTypes": [
                "driveItem"
            ],
            "query": {
                "queryString": "isDocument=true AND path:\"{document path}""
            }
        }
    ]
}

also posted this on StackOverflow

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,362 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,245 questions
{count} votes

Accepted answer
  1. RaytheonXie_MSFT 33,636 Reputation points Microsoft Vendor
    2023-11-23T06:14:28.46+00:00

    Hi @Bob Nemec,

    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.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful