Skip to content

Latest commit

 

History

History
131 lines (88 loc) · 5.08 KB

File metadata and controls

131 lines (88 loc) · 5.08 KB
title Download contents of a driveItemVersion resource
description Retrieve the contents of a specific version of a driveItem.
ms.localizationpriority medium
ms.subservice sharepoint
author spgraph-docs-team
doc_type apiPageType
ms.date 03/06/2024

Download contents of a driveItemVersion resource

Namespace: microsoft.graph

Retrieve the contents of a specific version of a driveItem.

Note: Getting the content of the current version is not supported. To do that, use the Download the contents of a driveItem method.

[!INCLUDE national-cloud-support]

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.

[!INCLUDE permissions-table]

HTTP request

GET /drives/{drive-id}/items/{item-id}/versions/{version-id}/content
GET /groups/{group-id}/drive/items/{item-id}/versions/{version-id}/content
GET /me/drive/items/{item-id}/versions/{version-id}/content
GET /sites/{site-id}/drive/items/{item-id}/versions/{version-id}/content
GET /users/{user-id}/drive/items/{item-id}/versions/{version-id}/content

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.

Response

Returns a 302 Found response redirecting to a preauthenticated download URL for the bytes of the file.

To download the contents of the file your application needs to follow the Location header in the response. Many HTTP client libraries will automatically follow the 302 redirection and start downloading the file immediately.

Preauthenticated download URLs are only valid for a short period of time (a few minutes) and don't require an Authorization header to download.

Example

This example retrieves a version of a file in the current user's drive.

Request

GET /me/drive/items/{item-id}/versions/{version-id}/content

[!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]


Response

The call returns a redirect to where the contents of the version can be downloaded.

HTTP/1.1 302 Found
Location: https://onedrive.com/34FF49D6...

Remarks

OneDrive doesn't preserve the complete metadata for previous versions of a file.

When your app retrieves the list of available versions for a file, a driveItemVersion resource is returned that provides the available information about the specific version.