Download a file in another format

Namespace: microsoft.graph

Warning

This endpoint requires TLS 1.2 to function normally. Microsoft announced the deprecation of TLS 1.0 and 1.1 for Office 365 and Azure AD services. Although Microsoft Graph still supports these two protocols, you might experience transport-level errors. For more information about the TLS 1.0 and 1.1 deprecation, see Enable support for TLS 1.2 in your environment.

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.

Permissions

One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

Permission type Permissions (from least to most privileged)
Delegated (work or school account) Files.Read, Files.ReadWrite, Files.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All
Delegated (personal Microsoft account) Files.Read, Files.ReadWrite, Files.Read.All, Files.ReadWrite.All
Application Files.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All

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

Optional request headers

Name Value Description
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}

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.