Graph API convert from CSV to PDF reporting "InputFormatNotSupported"

Mark L. Fowler 21 Reputation points
2021-04-26T13:18:42.78+00:00

Hi gang,

Using the Microsoft Graph API, we are attempting to upload a CSV file to SharePoint Online. Then, once uploaded, we're trying to convert the CSV file to PDF following this page:
https://learn.microsoft.com/en-us/graph/api/driveitem-get-content-format?view=graph-rest-1.0&tabs=http

We are successfully achieving the following steps so far:

  1. Getting access tokens at this endpoint: https://login.microsoftonline.com/AZURE_TENANT_ID/oauth2/v2.0/token
  2. Creating an upload session at this endpoint: https://graph.microsoft.com/v1.0/drives/DRIVE_ID/items/root:UPLOAD_FILE_PREFIX/FILE_TO_UPLOAD:/createUploadSession
  3. Uploading a file through our upload session at this dynamic endpoint: https://coopbenefitsgroup.sharepoint.com/sites/SHAREPPOINT_SITE/_api/v2.0/drives/DRIVE_ID/items/GUID/uploadSession?guid='0fe01aee-6686-4405-b8d1-2101b1c91cae'&overwrite=True&rename=False&dc=0&tempauth=TEMP_AUTH_TOKEN

Where we are running in to issues is when we're calling the Graph API endpoint to convert that uploaded file to PDF.

  1. We're doing that by calling this endpoint: https://graph.microsoft.com/v1.0/drives/DRIVE_ID/root:UPLOAD_FILE_PREFIX/FILE_TO_UPLOAD:/content?format=pdf

When we call that endpoint, though, we get a 406 Not Acceptable error with the following body:

{  
    "error": {  
        "code": "notSupported",  
        "message": "csv",  
        "innererror": {  
            "code": "InputFormatNotSupported"  
        }  
    }  
}  

Is conversion from CSV to PDF supported at this time? Has anyone run in to this issue before?

Cheers,
Mark

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,670 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,701 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jerryzy 10,566 Reputation points
    2021-04-27T09:11:54.387+00:00

    Hi @Mark L. Fowler ,

    I can reproduce when test in my side:

    91617-snipaste-2021-04-27-17-04-32.png

    Seems this result is not consistent with the official document.

    But now the error message specify the InputFormatNotSupported, so I think at least currently, the csv format can't convert to pdf, you can try another excel file format .xlsx which should be working if possible.

    Thanks
    Best Regards


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful