
Thanks for reaching out to Microsoft
Based on your description, I understand that you're using the Microsoft Graph /search/query API to implement search functionality across SharePoint sites, and you're encountering issues when trying to scope searches to specific folders or drives. Although the documentation suggests folder-level search is supported, your implementation returns no results when targeting a folder path.
As far as I know, the issue arises from a limitation in the Microsoft Graph Search API. As stated in the Search API overview, the API supports entity types like driveItem
and allows scoping queries using documentlink:
.
However, folder-level filtering using documentlink:
is not reliably supported. This behavior is confirmed in the Search OneDrive and SharePoint content documentation, which notes that while site-level scoping works, folder-level paths often fail to match correctly. Additionally, the API does not support site-level search schema customizations, which can further interfere with folder-specific queries.
From my perspective view, in this context, you can try using the Drive API for folder-specific queries. Instead of relying on /search/query
, you can use endpoints like /drive/root:/folderpath:/children
to directly list the contents of a folder. This method bypasses the limitations of the Search API and provides reliable access to folder-level data. Ensure your application has the appropriate permissions (Sites.Read.All
or Sites.Selected
) and that the content is properly indexed and accessible.
Link instruction: https://learn.microsoft.com/en-us/graph/api/driveitem-list-children?view=graph-rest-1.0&tabs=http
Hope my answer will help you, for further support, kindly let me know in the comment section
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.