V K
V K

Reputation: 1719

How to get items in the root of One Drive business using one drive API?

I am able to log user into the one drive business account.And I am also able to get drive details.But how do I get the details of files and folders in the root of the one drive business account?

Upvotes: 0

Views: 423

Answers (2)

Sk_
Sk_

Reputation: 1191

try this

GET /drive/root/children

https://dev.onedrive.com/items/list.htm

Possible response looks like

HTTP/1.1 200 OK
Content-Type: application/json

{
  "value": [
    {"name": "myfile.jpg", "size": 2048, "file": {} },
    {"name": "Documents", "folder": { "childCount": 4} },
    {"name": "Photos", "folder": { "childCount": 203} },
    {"name": "my sheet(1).xlsx", "size": 197 }
  ],
  "@odata.nextLink": "https://..."
}

Upvotes: 1

Sébastien Pertus
Sébastien Pertus

Reputation: 715

Accessing the détails of a drive is made with the /root/children path :

https://api.onedrive.com/v1.0/drive/root/children?$select=name

Upvotes: 1

Related Questions