ar099968
ar099968

Reputation: 7577

WOPI error: sorry you don't have permission to edit this document

I want implement WOPI protocol for open and edit Office document into the browser with Office 365:

When Microsoft send the CheckFileInfo request:

GET /api/wopi/files/{IDFILE}?access_token={TOKEN}&access_token_ttl=0

I send this is response:

{
    BaseFileName: 'test2.docx',
    OwnerId: '[email protected]',
    UserId: '[email protected]',
    Size: 12642,
    SHA256: null,
    Version: '0',
    SupportsDeleteFile: false,
    SupportsEcosystem: false,
    SupportsFolders: false,
    SupportsGetFileWopiSrc: false,
    SupportsGetLock: true,
    SupportsLocks: true,
    SupportsRename: false,
    SupportsUpdate: true,
    SupportsUserInfo: false
}

The editor shows this error

enter image description here

What am I doing wrong?

Upvotes: 1

Views: 1915

Answers (2)

Rachanee Saengkrajai
Rachanee Saengkrajai

Reputation: 190

You should return these fields in the response of CheckFileInfo.

  1. SupportUpdate : true (to let WOPI Client know that your API implement the PutFile and PutRelativeFile methods to update file)
  2. UserCanWrite : true (to indicate that the user has Write permission over the file)
  3. LicenseCheckForEditIsEnabled : true (to route user to Microsoft Login page to verify that the user has Office 365 license)
  4. HostEditUrl : <url_to_your_edit_page>

NOTE: Your user need MS Office 365 license in order to edit file on WOPI.
Valid XHTML.

Upvotes: 2

Ildar Zainulin
Ildar Zainulin

Reputation: 41

I had the same problem with Office Online Server.

Solution: You need to execute Get-OfficeWebAppsFarm from PowerShell as an admin, and check the EditingEnabled property.

If it is disabled then you can enable it via Set-OfficeWebAppsFarm -EditingEnabled:$true

Upvotes: 3

Related Questions