| author | spgraph-docs-team |
|---|---|
| ms.date | 09/10/2017 |
| title | List Drives |
| ms.localizationpriority | high |
| ms.subservice | sharepoint |
| description | Retrieve the list of Drive resources available for a target User, Group, or Site. |
| doc_type | apiPageType |
Namespace: microsoft.graph
Retrieve the list of Drive resources available for a target User, Group, or Site.
[!INCLUDE national-cloud-support]
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.
[!INCLUDE permissions-table]
To list the document libraries for a group, your app requests the drives relationship on the Group.
GET /groups/{groupId}/drivesTo list the document libraries for a site, your app requests the drives relationship on the Site.
GET /sites/{siteId}/drivesGET /users/{userId}/drivesGET /me/drivesThis method supports the $expand, $select, $skipToken, $top, and $orderby OData query parameters to customize the response.
| Name | Description |
|---|---|
| Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
If successful, this method returns a 200 OK response code and collection of Drive objects in the response body.
GET /me/drives
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
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
}
}
]
}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.