Share via

error calling onedrive API with $filter

Haopeng Huang 6 Reputation points
2024-12-01T00:36:14.76+00:00

Hi,

I have been using the onedrive API to get items with $filter like this:

GET https://graph.microsoft.com/v1.0/me/drive/root/children?$filter=endswith(name, '.docx')

It used to work for the last 2 years. But recently it stopped working and showed this error.

This is very frustrating. Can someone help please?

{
    "error": {
        "code": "notSupported",
        "message": "Operation not supported",
        "innerError": {
            "date": "2024-12-01T00:20:29",
            "request-id": "442724e3-4ada-4a95-92e8-f8feb2b51514",
            "client-request-id": "57146b7a-5452-3873-2387-8267a3bea79f"
        }
    }
}
Microsoft Security | Microsoft Graph

1 answer

Sort by: Most helpful
  1. Vasil Michev 127K Reputation points MVP Volunteer Moderator
    2024-12-01T16:20:42.8466667+00:00

    The LIST /children method does not support filtering, afaik. You were probably using a filter against /items instead?

    GET https://graph.microsoft.com/beta/me/drive/root/items?$filter=endsWith(name,+'.docx')
    

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.