MSGraph Api- how to get filename of the word file when sending word file as a binary using postman

JAPNAM SINGH 81 Reputation points
2021-06-28T17:13:33.06+00:00

Hi Team,

how do I get the filename based on https://graph.microsoft.com/v1.0/sites/site-id/drive/root:/{filename}:/content

while in postman because I am sending in the body as binary file and content type="text/plain" for the word file

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

1 answer

Sort by: Most helpful
  1. Danstan Onyango 3,736 Reputation points Microsoft Employee
    2021-06-30T10:13:26.917+00:00

    In the example https://graph.microsoft.com/v1.0/sites/site-id/drive/root:/{filename}:/content, the filename is the name of a new file. Quoting from the docs

    This example uploads the string "The contents of the file goes here." to a file in the signed-in user's drive under FolderA named FileB.txt.

    PUT /me/drive/root:/FolderA/FileB.txt:/content  
    Content-Type: text/plain  
      
    The contents of the file goes here.  
    

    In your case, the content will be the binary and filename will be something.docx.

    0 comments No comments