Onedrive API - filtering for Work/School account does not work?

Mykyta Samovarov 0 Reputation points
2023-06-14T12:28:56.4066667+00:00

Hello, when I try to use a graph explorer with a school or work account I get an error Operation not supported.

My problem is not listed in the documentation:

https://learn.microsoft.com/en-us/onedrive/developer/rest-api/concepts/filtering-results?view=odsp-graph-online

My scopes permissions are:

  • Files.Read.All
  • User.Read
  • offline_access

My request is:

https://graph.microsoft.com/v1.0/me/drive/root/children?$filter=file ne null

My response is:

Bad request 400

{

"error": {

"code": "notSupported",

"message": "Operation not supported",

"innerError": {

"date": "2023-06-14T08:34:47",

"request-id": "***",

"client-request-id": "***"

}

}

}

But when I remove the filter from the query, it succeeds without problems. Returns everything.

Also when I try to run a query with filter with regular (personal) account, query succeeds.

I also tried to assing all the possible Files persmission scopes, but it still does not work.

My question is:

Is that correct that for work/school account it is not possible to do filtering or am I missing some specific filter-scope?

Microsoft 365 and Office | OneDrive | For business | Windows
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2023-06-14T15:12:32.4733333+00:00

    Hello Mykyta Samovarov,

    Thanks for reaching out. Filtering is not supported for the File resource type. You can find more information on the File resource type here. I would suggest voicing your query and feedback on the Graph Feedback Forum.

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

    Thanks.


  2. Anonymous
    2023-06-15T14:46:28.3333333+00:00

    Hello Mykyta Samovarov,

    Good Day. Hope all is well.

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

    Thanks.


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.