I'm trying to search Sharepoint & Teams files through POST https://graph.microsoft.com/v1.0/search/query
. I passed the entityType
as listItem
in the request body so that I could able to search Sharepoint, Teams & Onedrive files.
But in my case, I should ignore the files from Onedrive.
Is there a way to filter OneDrive files & search only Sharepoint & Teams files?
The url of OneDrive files starts with https://contoso-my.sharepoint.com/
, and the url of SharePoint files starts with https://contoso.sharepoint.com/
.
So you could add filter in th query like this to ignore Onedrive files:
path:\"https://contoso.sharepoint.com/*\\"
Reference: https://learn.microsoft.com/en-us/graph/search-concept-files#example-5-use-filters-in-search-queries