About Microsoft Graph API Get OneDrive Word File Content

Gamze 21 Reputation points

Hi guys,

I am using Microsoft Graph Api for create, upload and download docx/doc document on OneDrive. But I want to reach only content inside the uploaded document or existing document in OneDrive. I tried the get item and download services with Postman, Graph Explorer website and java code. But the servces didn't return the only content. Could you help me about this?
if anyone has tried it before.

(The response result can be base64 or even binary, enough to return :) )

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
1,299 questions
Microsoft Graph Identity API
Microsoft Graph Identity API
A Microsoft API to access Azure Active Directory (Azure AD) resources to enable scenarios like managing administrator (directory) roles, inviting external users to an organization, and, if you are a Cloud Solution Provider (CSP), managing your customer's data.
284 questions
Microsoft Graph Files API
Microsoft Graph Files API
A Microsoft API to create an app that connects with files across OneDrive, OneDrive for Business, and SharePoint document libraries.
349 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
1,968 questions
0 comments No comments
{count} votes

Accepted answer
  1. Shivam Dhiman 5,766 Reputation points

    Hi @Gamze

    To get the content of your word file, locate that file in OneDrive using this endpoint.

    GET /me/drives/{drive-id}/root/children  

    Now get the items-id(word file id) from the response and put it in below endpoint in Postman to get the content of your word file.

    GET /drives/{drive-id}/items/{item-id}/content  

    Note: Response for this API https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{item-id}/content does not come in Graph Explorer due to CORS policy. Please use Postman(API client) to execute this request

    You can refer to this documentation for more details

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

0 additional answers

Sort by: Most helpful