I have come across an issue with the Graph API regarding the OData property filter
while filtering files inside a SP Library.
The property, for some reason, does not filter at all, although it is required (calling without the filter
property results in 400 BadRequest
). I've first come across this issue on Dec 17th 2024, it still persists.
The steps I've managed to repro the issue with:
design.json
, images.json
, remoteEndpoints.json
, questions.json
.)https://graph.microsoft.com/v1.0/sites/{siteId}/drives/{driveId}/items?$filter=name eq 'images.json'
images.json
is returned.The issue still looks to be persistent with more files in the library. I've tested this issue on multiple tenants with the same outcome. The issue does not seem to be attributed to a specific client, as it comes up both in our PROD code (hosted as an Azure Function) and in Graph Explorer. The PROD code, where this issue came up, has been running since July 2024 without changes and without any problems.
I have tried looking into Graph API's known issues, where there is a known issue thread regarding all OData queries, unfortunately, I could not find any mention of this issue.
Am I doing something wrong, or is there an issue in the service itself?
Thanks for all the advice!
Filtering driveItems
never didn't work properly. I would recommend to use /v1.0/search/query
endpoint for searching files
POST https://graph.microsoft.com/v1.0/search/query
{
"requests": [
{
"entityTypes": [
"driveItem"
],
"query": {
"queryString": "filename:images.json AND path:\"https://contoso.sharepoint.com/sites/<site_name>\""
}
}
]
}
with path
in queryString
you can reduce the searching to a specific site (document library or even to a specific folder)