Options for editing MS Word documents in Azure Storage Options for editing MS Word documents in Azure Storage azure azure

Options for editing MS Word documents in Azure Storage


Options for editing MS Word documents in Azure Storage

To edit MS Word document online, That saving the Word document to OneDrive is a good choice. OneDrive will provide a link for the file which we uploaded and we could view and edit the file based on this link.

Here are the detail steps.

  1. Read the MS Word document which you want to edit from Azure Storage.
  2. Save this document to OneDrive folder using OneDrive API and get the link from the response. Here is the HTTP request message which I used to upload file to OneDrive.
PUT https://graph.microsoft.com/v1.0/drive/root:/Documents/{filename}.docx:/content HTTP/1.1Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.documentAuthorization: Bearer {your token}Accept: application/jsonHost: graph.microsoft.comExpect: 100-continueConnection: Keep-AlivePut your file content here

We can get the link for the file from the webUrl property of response JSON object. It is like this,

"webUrl": "https://1drv.ms/w/s!AI164yLtIBq0gSA"

For more information, link below is for your reference.

Simple item upload to OneDrive using PUT

  1. Add web hook to your OneDrive folder. If anyone edit the file online, a message will be sent to your method and you can download the updated file and save to your Azure Storage. Here is a sample HTTP request message
POST /subscriptionsContent-Type: application/json{"notificationUrl": "https://xxxx.azurewebsites.net/api/webhook-receiver","expirationDateTime": "2018-01-01T11:23:00.000Z","resource": "/me/drive/root","changeType": "updated","clientState": "client-specific string"}

For more information, link below is for your reference.

WebHooks - Adding a new subscription

  1. Delete files from OneDrive folder if the folder is full.