Skip to content

Latest commit

 

History

History
136 lines (95 loc) · 5.33 KB

File metadata and controls

136 lines (95 loc) · 5.33 KB
author spgraph-docs-team
ms.date 09/10/2017
title Convert to other formats
ms.localizationpriority high
ms.subservice sharepoint
description Use this API to retrieve the contents of an item in a specific format.
doc_type apiPageType

Download a file in another format

Namespace: microsoft.graph

Use this API to retrieve the contents of an item in a specific format. Not all files can be converted into all formats.

To download the item in its original format, see download an item's contents.

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

Note

The maximum size limit for files to use format conversion is 2 MB.

HTTP request

GET /drive/items/{item-id}/content?format={format}
GET /drive/root:/{path and filename}:/content?format={format}

Query parameters

Parameter Type Description
format string Specify the format the item's content should be downloaded as.

Format options

The following values are valid for the format parameter:

Format value Description Supported source extensions
pdf Converts the item into PDF format. csv, doc, docx, odp, ods, odt, pot, potm, potx, pps, ppsx, ppsxm, ppt, pptm, pptx, rtf, xls, xlsx
html Converts the item into HTML format. loop, fluid, wbtx

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
if-none-match String. If this request header is included and the eTag (or cTag) provided matches the current tag on the file, an HTTP 304 Not Modified response is returned.

Example

GET /me/drive/items/{item-id}/content?format={format}

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

Returns a 302 Found response redirecting to a pre-authenticated download URL for the converted file.

To download the converted file, your app must follow the Location header in the response.

Pre-authenticated URLs are only valid for a short period of time (a few minutes) and do not require an Authorization header to access.

HTTP/1.1 302 Found
Location: https://b0mpua-by3301.files.1drv.com/y23vmagahszhxzlcvhasdhasghasodfi

Error responses

See Error Responses for more information about how errors are returned.