2

I would like to get all the contents of a folder in OneDrive. The folder has child folders within it, and child folders within them, e.g.:

Parent/
└── Child1/
    ├── Child1.1/
    │   ├── File1.1.1
    │   └── File1.1.2
    └── Child1.2/
        ├── File1.2.1
        └── File1.2.2

I would like to maintain knowledge about folder hierarchy, basically something like Parent/Child1/File1.1.1 so I can't use the empty query graph search approach referenced here, which returns everything in a flat format without any information about the hierarchy.

I could recursively call each folder one by one but that would be a lot since there are thousands of folders in the parent directory.

Based on the docs (and here too), I would have expected the expand=children parameter to work, but it seems not to. Any ideas?

GET https://graph.microsoft.com/v1.0/me/drive/items/<id>/children?$expand=children
{
  "error": {
    "code": "notSupported",
    "message": "Operation not supported",
    "innerError": {
      "date": "2022-12-17T17:03:28",
      "request-id": "",
      "client-request-id": ""
    }
  }
}
Peter
  • 1,065
  • 14
  • 29
  • 1
    Maybe similar question: https://stackoverflow.com/questions/60440298/microsoft-graph-list-children-including-grandchildren but still without solution – user2250152 Dec 19 '22 at 09:38

1 Answers1

0

Use this url to get children listing, I have pasted the link below.

GET https://graph.microsoft.com/v1.0/me/drive/items/<id>?expand=children
Samuel Liew
  • 76,741
  • 107
  • 159
  • 260