2

Can anybody tell me how to get a list of just files in a particular folder on OneDrive using Microsoft Graph API? I believe I found an approach I have to use but either I don't understand something or it is impossible. I can get a list of children items in a folder. I can use $filter=folder ne null to get just a list of folders but I don't understand how to get a list of files. If I negate the expression, make it $filter=folder eq null it gives me an error. I tried many other possible expressions like $filter=file ne null, $filter=size ne 0 even though it is not exactly a filter for files a files can be 0 size but anyway it gives an error as well.

Update:

Tested in a test tool. It gives

{
"error": {
    "code": "invalidRequest",
    "message": "Invalid request",
    "innerError": {
        "date": "2021-02-23T06:25:08",
        "request-id": "4d1903d3-d989-4d90-8130-479ac1b24af2",
        "client-request-id": "4d1903d3-d989-4d90-8130-479ac1b24af2"
    }
}

for this query

https://graph.microsoft.com/v1.0/me/drive/root/children$filter=folder eq null

Here is the link to the tool

https://developer.microsoft.com/en-us/graph/graph-explorer
Alex
  • 655
  • 1
  • 8
  • 16
  • What error are you getting? This works for me `/me/drive/root/children?$filter=folder eq null&select=name` This also works for me `/drives/{drive-id}/items/{drive-item-id/folder-id}/children?filter=folder ne null` – Danstan Feb 22 '21 at 23:19
  • 1
    For ?filter=folder eq null, getting response as { "error": { "code": "notSupported", "message": "The request is not supported by the system.", "innerError": { "date": "2021-04-15T07:08:56", "request-id": "5b5e0b21-a774-4814-86d0-c9da5436e4c0", "client-request-id": "5b5e0b21-a774-4814-86d0-c9da5436e4c0" } } } @Danstan – Khushboo Mulani Apr 15 '21 at 07:09

0 Answers0