How to update media in a driveItem in sharepoint using graph api

Arnav Lala 20 Reputation points
2024-04-15T07:59:22.9566667+00:00

Hello,

I'm currently working on updating a driveItem in SharePoint using the Microsoft Graph API. While I've been successful in updating fields like name and title, I'm now looking to update the actual media content itself using the API.

For instance, if a user edits a Word document within my application, I need to reflect those changes in the linked SharePoint driveItem. What would be the recommended approach to achieve this?

I've referred to the documentation here, but I couldn't find specific guidance on updating the media content of a driveItem.

Any insights or suggestions on how to accomplish this task using the Microsoft Graph API would be greatly appreciated.

Thank you!

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

Accepted answer
  1. RaytheonXie_MSFT 31,226 Reputation points Microsoft Vendor
    2024-04-16T02:27:47.7433333+00:00

    Hi @Arnav Lala,

    We are unable to update the data in file by graph directly. You could use ByteArrayInputStream in java to edit the content of the file. Please refer to the following issue simialr with yours

    https://stackoverflow.com/questions/60541711/microsoft-graph-updating-a-document-with-a-put-request-java


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

    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 comments No comments

0 additional answers

Sort by: Most helpful