Kryglui
Kryglui

Reputation: 11

Can't save office online wopi documents back to the server

I'm working on WOPI integration with one of our internal tools and I'm stuck with one issue while saving documents in client.

I was able to set up ClientUrl to a GET method that returns file contents as "application/octet-stream". After that, by clicking "Edit in Word", Word opens successfully with needed document. But I can save only a copy of document locally.

I implemented methods for the same URL not only for GET, but POST and PUT also, and was hoping that Word will try to save this file by calling them with file contents, but currently I can't even save from Word.

I want to implement same functionality as SharePoint/OneDrive has, that allow me to save opened document directly to the server.

Can please some one help me with this?

Upvotes: 0

Views: 1851

Answers (1)

rocky
rocky

Reputation: 7696

Depending on whether you are integrating with Office Online Server 2016 or Office Web Apps 2013 you should refer to the new or the old documentation respectively.

To successfully implement the "Save" operation, you have to:

  • set SupportsUpdate to true in CheckFileInfo
  • implement the corresponding operations: PutFile (mandatory) and PutRelativeFile (optional, used for creating new files, not necessarily required for updating)
  • if you want to support OWA 2013, you'll have to implement so called "Cobalt", aka MS-FSSHTTP. Fortunately, this is no longer required with OOS 2016
    • in this case, it's important to set SupportsCobalt and SupportsCoauth capabilities of CheckFileInfo to true
  • it's also wise to implement locking to prevent any conflicts when editing. set SupportsLocks and implement the corresponding methods

If you need some examples, search GitHub for ms-wopi tag.

If you want to support updating from the desktop version of MS Word, that's a whole different story. You need to look somewhere else - it can be accomplished by implementing WebDAV (an extension on top of HTTP). Not unlike MS-WOPI, it's a quite complex protocol. I'd recommend using an external library, such as WebDAV server from IT Hit. That should make your life easier.

Upvotes: 2

Related Questions