List available drives
Namespace: microsoft.graph
Retrieve the list of Drive resources available for a target User, Group, or Site.
This API is available in the following national cloud deployments.
Global service | US Government L4 | US Government L5 (DOD) | China operated by 21Vianet |
---|---|---|---|
✅ | ✅ | ✅ | ✅ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type | Least privileged permissions | Higher privileged permissions |
---|---|---|
Delegated (work or school account) | Files.Read | Files.Read.All, Files.ReadWrite, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All |
Delegated (personal Microsoft account) | Files.Read | Files.Read.All, Files.ReadWrite, Files.ReadWrite.All |
Application | Files.Read.All | Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All |
HTTP request
List a group's drives
To list the document libraries for a group, your app requests the drives relationship on the Group.
GET /groups/{groupId}/drives
List a site's drives
To list the document libraries for a site, your app requests the drives relationship on the Site.
GET /sites/{siteId}/drives
List a user's drives
GET /users/{userId}/drives
List the current user's drives
GET /me/drives
Optional query parameters
This method supports the $expand
, $select
, $skipToken
, $top
, and $orderby
OData query parameters to customize the response.
Request headers
Name | Description |
---|---|
Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
Response
If successful, this method returns a 200 OK
response code and collection of Drive objects in the response body.
Examples
Request
GET /me/drives
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives",
"value": [
{
"createdDateTime": "2017-07-27T02:41:36Z",
"description": "",
"id": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
"lastModifiedDateTime": "2018-03-27T07:34:38Z",
"name": "OneDrive",
"webUrl": "https://m365x214355-my.sharepoint.com/personal/meganb_m365x214355_onmicrosoft_com/Documents",
"driveType": "business",
"createdBy": {
"user": {
"displayName": "System Account"
}
},
"lastModifiedBy": {
"user": {
"email": "MeganB@contoso.com",
"id": "48d31887-5fad-4d73-a9f5-3c356e68a038",
"displayName": "Megan Bowen"
}
},
"owner": {
"user": {
"email": "MeganB@contoso.com",
"id": "48d31887-5fad-4d73-a9f5-3c356e68a038",
"displayName": "Megan Bowen"
}
},
"quota": {
"deleted": 0,
"remaining": 1099217021300,
"state": "normal",
"total": 1099511627776,
"used": 294606476
}
}
]
}
Remarks
Most users will only have a single Drive resource.
Groups and Sites may have multiple Drive resources available.
Drives with the system facet are hidden by default.
To list them, include system
in your $select
statement.