Filtering on item name in Graph API call

Sam 20 Reputation points


I am trying to find details about a specific item in a SharePoint list named "My Reports". The following Graph request works: Reports/Items

But this requires me to then search through the contents of the "My Reports" list for the subsequent files and folders. I am looking for a way to apply the filter in the Graph API call rather than looping through the contents and doing the filtering in another programming language. I am hoping to do something similar to the following to locate the folder named "TestFolder": Reports/Items?$ eq TestFolder

This does not run. Is a way to add a filter on the item name using the filter parameter?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,447 questions
0 comments No comments
{count} votes

Accepted answer
  1. CarlZhao-MSFT 36,336 Reputation points

    Hi @Sam

    Yes, you can filter files based on item name.

    First list the root directory file set, and then filter according to the file name:

    GET{site id}/lists/{list id}/drive/root/children?$filter=name eq '{item name}'

    Hope this helps.

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

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful