Is there a way to get a word document as a PDF

GSH-1402 45 Reputation points
2023-10-31T08:21:00.8466667+00:00

I am trying to download the Word document of a given version and I am using below endpoint,

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

When I am using it, I get a docs file, I am hoping to download a PDF version and adding format?pdf to the end also did not work.

Is there a way to get a PDF file instead of a Word file.

Thank you very much.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,795 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. AsithwMSFT 1,425 Reputation points Microsoft Vendor
    2023-11-20T02:03:54.4366667+00:00

    Hello GSH-1402

    Have you checked the content convert Graph API

    https://learn.microsoft.com/en-us/graph/api/driveitem-get-content-format?view=graph-rest-1.0&tabs=http#http-request

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

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.