author | ms.date | title | ms.localizationpriority | ms.subservice | description | doc_type |
---|---|---|---|---|---|---|
spgraph-docs-team |
09/10/2017 |
Get Drive |
high |
sharepoint |
Retrieve the properties and relationships of a Drive resource. |
apiPageType |
Namespace: microsoft.graph
Retrieve the properties and relationships of a Drive resource.
A Drive is the top-level container for a file system, such as OneDrive or SharePoint document libraries.
[!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]
The signed in user's drive (when using delegated authentication) can be accessed from the me
singleton.
If a user's OneDrive isn't provisioned but the user has a license to use OneDrive, this request will automatically provision the user's drive, when using delegated authentication.
GET /me/drive
To access a user's OneDrive or OneDrive for Business, your app must request the drive relationship on the User resource.
If a user's OneDrive isn't provisioned but the user has a license to use OneDrive, this request will automatically provision the user's drive, when using delegated authentication.
GET https://graph.microsoft.com/v1.0/users/{idOrUserPrincipalName}/drive
Parameter name | Value | Description |
---|---|---|
idOrUserPrincipalName | string | Required. The identifier for the user object who owns the OneDrive. |
To access a Group's default document library, your app requests the drive relationship on the Group.
GET /groups/{groupId}/drive
Parameter name | Value | Description |
---|---|---|
groupId | string | Required. The identifier for the group that owns the document library. |
To access a Site's default document library, your app requests the drive relationship on the Site.
GET /sites/{siteId}/drive
Parameter name | Value | Description |
---|---|---|
siteId | string | Required. The identifier for the site that contains the document library. |
If you have the unique identifier for a drive, you can access it directly from the top-level drives collection.
GET /drives/{driveId}
Parameter name | Value | Description |
---|---|---|
driveId | string | Required. The identifier for the drive requested. |
These methods support the $select query parameter to shape the response.
Name | Description |
---|---|
Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
Each of these methods returns a Drive resource for the matching drive in the response body.
If the drive doesn't exist and can't be provisioned automatically (when using delegated authentication) an HTTP 404
response will be returned.
GET /me/drive
[!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]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
HTTP/1.1 200 OK
Content-type: application/json
{
"id": "b!t18F8ybsHUq1z3LTz8xvZqP8zaSWjkFNhsME-Fepo75dTf9vQKfeRblBZjoSQrd7",
"driveType": "business",
"owner": {
"user": {
"id": "efee1b77-fb3b-4f65-99d6-274c11914d12",
"displayName": "Ryan Gregg"
}
},
"quota": {
"deleted": 256938,
"remaining": 1099447353539,
"state": "normal",
"total": 1099511627776
}
}