1

I am trying to implement previews(WOPI) for my files stored in local file system. I am trying to implement it using the Office Online Server Farm we have. I used the below code but its calling the "Get" endpoint but after that its not calling the "contents" end point.

URL - http://ServerName/wv/wordviewerframe.aspx?ui=1033&rs=1033&dchat=false&hid=1&IsLicensedUser=1&WOPISrc=http://WOPIHost:8082/wopi/files/00000000-0000-0000-0000-000000000000&access_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6InhYbFQwSUp4MlZCVEJFeVFMdGtFOFY2ZkhwZyJ9%2EeyJhdWQiOiJ3b3BpL3F1aW50aWxlcy5zaGFyZXBvaW50LmNvbUA1OTg5ZWNlMC1mOTBlLTQwYmYtOWM3OS0xYTdiZWNjZGI4NjEiLCJpc3MiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDBAOTAxNDAxMjItODUxNi0xMWUxLThlZmYtNDkzMDQ5MjQwMTliIiwibmJmIjoiMTU4MzIxOTgwNCIsImV4cCI6IjE1ODMyNTU4MDQiLCJuYW1laWQiOiIwIy5mfG1lbWJlcnNoaXB8Z29rdWwuYWdAaW4uaW1zaGVhbHRoLmNvbSIsIm5paSI6Im1pY3Jvc29mdC5zaGFyZXBvaW50IiwiaXN1c2VyIjoidHJ1ZSIsImNhY2hla2V5IjoiMGguZnxtZW1iZXJzaGlwfDEwMDMzZmZmOWIxNjZlNmNAbGl2ZS5jb20iLCJzaWduaW5fc3RhdGUiOiJbXCJrbXNpXCIsXCJkdmNfZG1qZFwiXSIsImlzbG9vcGJhY2siOiJUcnVlIiwiYXBwY3R4IjoiMjBhMTViZGM2Y2QyNDRjMzkyMzNjYjQxNDFiNDc1OTU7dlhqbUZlRWpsc2p4TTFaeTMxT2ZFVmlKQUUwPTtEZWZhdWx0Ozs3RkZGRkZGRkZGRkZGRkZGO1RydWU7OzswO2RlMTYzYjlmLWEwMTgtYTAwMC1mZWRiLTQ1MzBmN2Q0MjYwMSJ9%2EXmvaQMvtq0ClU1rHW%5FibIx7OjQ7nbmXVO9Bs3JmH%2DCqxdxtaJKKqC9sd3j2cjfFIIsYFw%2DOpoZ6rpp5ijcl3WwWJWX0uR%2DsgdAi4If49dQnbDDunvLdCuKl%2D7PFc96M60ByVa0jbywUvFW8FhoR2bPdVMBYiILC5oExEkOc4BCGgWoUNE9n%2Dv74fWJrFbJFtMVaof3n%2DQCQHy8SXh%5F3O2SaSVw9bMPYdELSbPnvqsz4l8mUrEbN%2Dhs3kW2n3d1nSuhjcEn8JyMZUrFk%5Fxl2GEbGh8A2KavTql1W5MBlXPzL2r4Ynn1A3XTguYcsieF%5FORhCemm%5FMFbDGMgUvlb%2Dkwg&access_token_ttl=1583752281063

    {
        [WopiTokenValidationFilter]
        [HttpGet]
        [Route("wopi/files/{id}")]
        public async Task<HttpResponseMessage> Get(Guid id)
        {
            //Handles CheckFileInfo
            return await HttpContext.Current.ProcessWopiRequest();
        }

        [WopiTokenValidationFilter]
        [HttpGet]
        [Route("wopi/files/{id}/contents")]
        public async Task<HttpResponseMessage> Contents(Guid id)
        {
            //Handles GetFile
            return await HttpContext.Current.ProcessWopiRequest();
        }

        [WopiTokenValidationFilter]
        [HttpPost]
        [Route("wopi/files/{id}")]
        public async Task<HttpResponseMessage> Post(Guid id)
        {
            //Handles Lock, GetLock, RefreshLock, Unlock, UnlockAndRelock, PutRelativeFile, RenameFile, PutUserInfo
            return await HttpContext.Current.ProcessWopiRequest();
        }

        [WopiTokenValidationFilter]
        [HttpPost]
        [Route("wopi/files/{id}/contents")]
        public async Task<HttpResponseMessage> PostContents(Guid id)
        {
            //Handles PutFile
            return await HttpContext.Current.ProcessWopiRequest();
        }
    }``` 
rocky
  • 7,506
  • 3
  • 33
  • 48
gokul731
  • 41
  • 4
  • 1
    Please provide us with the `CheckFileInfo` response from the `wopi/files/{id}` endpoint. It should be a [JSON with at least these 5 required properties](https://wopi.readthedocs.io/projects/wopirest/en/latest/files/CheckFileInfo.html#required-response-properties): BaseFileName, OwnerId, Size, UserId, Version. – rocky Mar 12 '20 at 20:08

2 Answers2

1

Finally I identified the issue. The Version field should be string like "1.0.0.0" instead of int.

gokul731
  • 41
  • 4
0

This is the response - {"UserId":"user@domain.com","CloseUrl":"https://<server>:8082","HostEditUrl":"http://<server>/we/wordeditorframe.aspx?ui=1033&rs=1033&dchat=false&hid=1&IsLicensedUser=1&WOPISrc=http://<server>:8082/wopi/files/00000000-0000-0000-0000-000000000000","HostViewUrl":"http://<server>/wv/wordviewerframe.aspx?ui=1033&rs=1033&dchat=false&hid=1&IsLicensedUser=1&WOPISrc=http://<server>:8082/wopi/files/00000000-0000-0000-0000-000000000000","SupportsCoauth":false,"SupportsExtendedLockLength":false,"SupportsFileCreation":false,"SupportsFolders":false,"SupportsGetLock":true,"SupportsLocks":true,"SupportsRename":true,"SupportsScenarioLinks":false,"SupportsSecureStore":false,"SupportsUpdate":true,"SupportsUserInfo":true,"LicensesCheckForEditIsEnabled":true,"ReadOnly":false,"RestrictedWebViewOnly":false,"UserCanAttend":false,"UserCanNotWriteRelative":false,"UserCanPresent":false,"UserCanRename":true,"UserCanWrite":true,"WebEditingDisabled":false,"Actions":null,"id":"00000000-0000-0000-0000-000000000000","LockValue":null,"LockExpires":null,"OwnerId":"user@domain.com","BaseFileName":"Test.docx","Container":null,"Size":102400,"Version":1,"UserInfo":null}

gokul731
  • 41
  • 4