office365azure-blob-storagegoogle-document-viewer

Office 365 document viewer - doesn't work with azure storage shared access url?


This neat url here will allow you to view any public/web accessible word, excel, powerpoint, etc. document can be viewed online:

https://view.officeapps.live.com/op/view.aspx?src=URL_TO_YOUR_FILE

I have had success using it for documents stored in azure blob storage in containers with public access. But if I try to use a document url for a file that is in a private container (using a shared access signature url) I get an error that the file is not found.

Same issue with the google docs document viewer:

https://docs.google.com/viewer?

How can I get this working with private files (using shared access signature urls)?

EDIT

Interestingly, if I use a tinyurl URL created from the shared access signature, it works.


Solution

  • How can I get this working with private files (using shared access signature urls)?

    According to your description, I tested it on my side and reproduced this issue. As View Office documents in a browser mentioned that the needs to be URL encoded, and the document must be publicly accessible on the internet.

    For a simple way, you could create your online document URL via this official tool. Also, you could create the URL by yourself as follows:

    https://view.officeapps.live.com/op/view.aspx?src=URLEncode(URL_TO_YOUR_FILE)