Tuesday, May 30, 2017

Embedding a OneDrive for Business file anonymously

OneDrive for Business gives you the ability to share files with others quickly and easily. You can even share files with others so that anyone can view them without needing a login. This is known as anonymous sharing.

clip_image002

To share anonymously, firstly ensure that you have enabled your users to share OneDrive content with external users as shown above. You’ll find that setting at:

https://admin.onedrive.com/?v=SharingSettings

which you need to access as a global administrator.

image

Next, select the file you want to share in OneDrive and then select Copy link from the menu across the top. Set the desired permissions. I’d generally recommend you set these to read only.

Copy the link which should look like:

https://ciaops365e1-my.sharepoint.com/personal/admin_ciaops365_com/_layouts/15/guestaccess.aspx?docid=0b35508db56c24e4293bb50e33391c1b0&authkey=AXr72CMhu3Pqd8d6jUwjkpE

image

If you now plug that into another browser or an ‘in-private’ browser session the file contents should be display as shown above.

If the document doesn’t appear or you are prompted to login then you need to double check your document sharing.

However, let’s now say you want to embed this document into a public web page.

image

If you return to the source document in OneDrive for Business and view that document is a browser by clicking on it, the document should display. If you you select the three dots at the right a menu should appear as shown above. From that menu, select the Embed option

image

You should now see an embed dialog like that shown above. You will notice that the embed is also listed.

image

However, if you copy and paste that code you end up with a web page like that shown above that asks for a login.

From what I can determine the embed code provided is only for embedding inside something like a Team Site in Office 365. The embed code is not for use with anonymous external users. That is, it won’t work for public viewing on the Internet.

However, the native embed codes appears as:

image

If you replace:

image

with the actual sharing link you received originally, the embed code then looks like:

image

If you now use that edited embed code in a a public web page, that page should now appear with the embedded file item from OneDrive for Business like so:

image

So the trick when it comes to embedding anonymous document from OneDrive for Business is to change the embed code to include the URL of the external sharing link you received when you shared the file with everyone.

Not as nice as other applications can embed anonymous documents, but then really, Office 365 isn’t really aimed at sharing information anonymously now is it? I’m also pretty sure Microsoft have this anonymous embedding feature on the roadmap but my guess is that it doesn’t have a high priority at this stage.

I have embedded that file below to confirm that doing so anonymously is possible: