1

We have files in Sharepoint Online (and OneDrive) in our O365 tenant, but Sharepoint Online is not used as UI for our internal systems. So now the requirement came up to initiate co-authoring in this web application (drupal).

I have seen that Microsoft Word can not only open files in any webbrowser from Sharepoint but also from other systems via WebDav in the background (file in webdav, javascript to create a specific link to the webdav file and word opens up that file and saves back to WebDav). I have also read a lot of the Microsoft Graph API documentation, but I still can't quite picture a path. The part I have solved: List files from Sharepoint Online in the Drupal frontend.

What should I research to be able to create specific links in the frontend of Drupal next to the file lists to allow word to remotely open the files from Sharepoint Online? All users have O365 logins by the way.

Any tips or hints would be much appreciated. Don't mind adding bounty or paying somebody who can really go into the details.

  • I'm not clear on what you mean by "initiate co-authoring". Do you want two or more people to edit at the same time? – CarlF Feb 27 at 19:45
  • 1
    @CarlF "Co-authoring" is Microsoft's standard Office term for allowing multiple users to edit in parallel on the same document without blocking each other. – willman Feb 28 at 16:37
  • @willman, isn't that the default behavior in SharePoint documents edited using Office Online? – CarlF Mar 1 at 3:42
  • 1
    If you manually "get a link" from a document through the UI, then yes, that URL defaults to opening in Office Online for co-authoring, but if you are getting an absolute URL direct to the file through the graph API, it will not open in office online unless you append a ?web=1 to the end. – willman Mar 1 at 4:23
1

If you are already dynamically retrieving the webUrl from the Graph API for the documents in SharePoint, simply appending a ?Web=1 to the end of the document Url will open the document in Office online in the Browser.

For example, if the API returns a document with "webUrl": "https://mytenant.sharepoint.com/sites/pocsite/Shared%20Documents/KeyProgress.xlsx"

then you render the anchor tag for that item as href="https://mytenant.sharepoint.com/sites/pocsite/Shared%20Documents/KeyProgress.xlsx?Web=1", the document will open in the online viewer/editor. If the user has contribute rights or higher, it will default to opening in Edit Mode, if the user only has Read access, the document will open in the online viewer. Of course, if the current user does not have rights to the document, they will get a 401 error.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.