Skip to content

DriveItem: download a file in another format error when converting from .xls to .pdf #912

Closed
@LuchiLucs

Description

@LuchiLucs

Describe the bug

From the documentation it states that the format .xls is supported for the conversion into the format .pdf but when trying the API I get the error code:

Error downloading file 'root:/pdf_conversion/amg 27-09.xls:': 
        APIError
        Code: 406
        message: None
        error: MainError(additional_data={'innererror': {'code': 'invalidFileFormat'}}, code='notSupported', details=None, inner_error=None, message='Error from Office Service. Url=
https://euc.excelcs.officeapps.live.com/document/export/pdf
HttpCode=UnsupportedMediaType', target=None)

I have not attached an example code because the codebase is working as expected for other files formats such as .xlsx and .docx and the error code seems to indicate that this is not an implementation error but a server-side error due to the unsupported file format (even though the documentation states the opposite).

Would you mind elaborating more on my use case? Can I debug further? Can I try something else?

Expected behavior

The conversion should happen

How to reproduce

# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.drives.item.items.item.content.content_request_builder import ContentRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
query_params = ContentRequestBuilder.ContentRequestBuilderGetQueryParameters(
		format = "{format}",
)

request_configuration = RequestConfiguration(
query_parameters = query_params,
)

await graph_client.drives.by_drive_id('drive-id').items.by_drive_item_id('driveItem-id').content.get(request_configuration = request_configuration)

SDK Version

No response

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugA broken experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions