The drive resource is the top level object representing a user's OneDrive or a document library in SharePoint.
OneDrive users will always have at least one drive available, their default drive. Users without a OneDrive license may not have a default drive available.
JSON representation
Here is a JSON representation of a Drive resource.
The drive resource is derived from baseItem and inherits properties from that resource.
{
"activities": [{"@odata.type": "microsoft.graph.itemActivity"}],
"id": "string",
"createdBy": { "@odata.type": "microsoft.graph.identitySet" },
"createdDateTime": "string (timestamp)",
"description": "string",
"driveType": "personal | business | documentLibrary",
"items": [ { "@odata.type": "microsoft.graph.driveItem" } ],
"lastModifiedBy": { "@odata.type": "microsoft.graph.identitySet" },
"lastModifiedDateTime": "string (timestamp)",
"name": "string",
"owner": { "@odata.type": "microsoft.graph.identitySet" },
"quota": { "@odata.type": "microsoft.graph.quota" },
"root": { "@odata.type": "microsoft.graph.driveItem" },
"sharepointIds": { "@odata.type": "microsoft.graph.sharepointIds" },
"special": [ { "@odata.type": "microsoft.graph.driveItem" }],
"system": { "@odata.type": "microsoft.graph.systemFacet" },
"webUrl": "url"
}
Properties
| Property | Type | Description |
|---|---|---|
| createdBy | identitySet | Identity of the user, device, or application which created the item. Read-only. |
| createdDateTime | dateTimeOffset | Date and time of item creation. Read-only. |
| description | String | Provide a user-visible description of the drive. Read-write. |
| driveType | String | Describes the type of drive represented by this resource. OneDrive personal drives will return personal. OneDrive for Business will return business. SharePoint document libraries will return documentLibrary. Read-only. |
| id | String | The unique identifier of the drive. Read-only. |
| lastModifiedBy | identitySet | Identity of the user, device, and application which last modified the item. Read-only. |
| lastModifiedDateTime | dateTimeOffset | Date and time the item was last modified. Read-only. |
| name | string | The name of the item. Read-write. |
| owner | identitySet | Optional. The user account that owns the drive. Read-only. |
| quota | quota | Optional. Information about the drive's storage space quota. Read-only. |
| sharepointIds | sharepointIds | Returns identifiers useful for SharePoint REST compatibility. Read-only. |
| system | systemFacet | If present, indicates that this is a system-managed drive. Read-only. |
| webUrl | string (url) | URL that displays the resource in the browser. Read-only. |
Relationships
| Relationship | Type | Description |
|---|---|---|
| activities | itemActivity collection | The list of recent activities that took place under this drive. |
| items | DriveItem collection | All items contained in the drive. Read-only. Nullable. |
| root | DriveItem | The root folder of the drive. Read-only. |
| special | DriveItem collection | Collection of common folders available in OneDrive. Read-only. Nullable. |
| list | List | For drives in SharePoint, the underlying document library list. Read-only. Nullable. |
Methods
| Common task | HTTP method |
|---|---|
| Get Drive metadata of another Drive | GET /drives/{drive-id} |
| Get root folder for user's default Drive | GET /drive/root |
| List activities under the Drive | GET /drive/activities |
| List children under the Drive | GET /drive/root/children |
| List changes for all Items in the Drive | GET /drive/root/delta |
| Search for Items in the Drive | GET /drive/root/search |
| Access special folder | GET /drive/special/{name} |
In the previous table, the examples use /drive, but other pathes are valid too.