SamuelMcNeill.com

Tech, bikes & random thoughts

How To: Publicly Embed OneDrive For Business Documents

I get asked a bunch of questions around Office365 and Windows 10 and eventually I decide it’s probably worth explaining the “how to” answer in a blog post. One that has popped up consistently over the last year from time to time is:

How do I embed a Word, PowerPoint or Excel document that I have stored in OneDrive For Business or SharePoint into my blog / Learning Management / Intranet?

It’s a great question, because ideally we want to be able to work off a single document, stored in the cloud, that we can share publicly in a website context such as a blog or intranet, without needing to have duplicates of the file floating around. Because of security concerns, this is not a straight forward exercise in OneDrive For Business or SharePoint because, rightfully, many businesses want to restrict what is shared externally.

Interestingly, and somewhat frustratingly, it’s super easy to embed documents for anonymous viewing using the consumer OneDrive.com service e.g.

4.PNG
With OneDrive.com, you can see it generates anonymous/publicly accessibly embed code with a single click, helpfully giving dimension settings as a configurable option.

The process to achieve the same outcome in OneDrive For Business is slightly more complex, but it can be done and this is a good guide demonstrating how to achieve this using Excel Online as the example. For those desperate for a visual explanation, I’ve made a screencast showing how this can be done in just a couple of minutes:

If you want the step by step, then it’s basically:

  • Go to your document hosted in OneDrive for Business and click the “share” button in the top right hand corner. When the “Share” box opens you need to ensure that the document is set to “Anyone with the link and view and edit” – you can turn off editing if you wish by expanding this drop-down menu. Then click “Copy Link”

1

  • If your settings are correct you should get the green tick once you have hit copy:

2.PNG

  • The above PowerPoint had some additional HTML wrapped around it to control the size of the iFrame as well e.g. width=”560″ height=”290″
  • You can test your code at a website like this one by pasting the link you copied – don’t forget to include the “&action=embedview:

3.PNG

Below is the same Word Online document embedded into this blog post:

If you’re really keen to get stuck in with this, then do check out this link again which provides you with additional variables you can include e.g. ability to interact with an embedded Excel document,

13 responses to “How To: Publicly Embed OneDrive For Business Documents”

  1. Crispin Lockwood Avatar
    Crispin Lockwood

    Thanks for this Sam. Have been struggling with this one for some time. Would be great for MS to simplify the process if they allow this ‘work around’ to function anyway!

  2. Dona Avatar
    Dona

    Hi,

    this method don’t work now, because it seems that they have set ‘X-Frame-Options’ to ‘sameorigin’, so append “&action=embedview” not work.

    Do you know where I can ask about this with Microsoft?

    Thanks

  3. DrD Avatar
    DrD

    If you switch back to Classic view the embed option is still there. Why it is removed from new view Microsoft only knows, and in other forums the MS Staff say it isn’t supported in OD4Business – really????

  4. David Regis Avatar

    Do you know if there’s a way to embed a OneDrive for Business folder instead of a file?

  5. Mike B Avatar

    is there any way to do the same with a personal onedrive-onenote file? ie, not business/365/sharepoint?
    i can get an icon/link to show up but not the embedded onenote
    thanks

  6. Jerz Avatar
    Jerz

    This worked for me! Thank you so much!

  7. Anjali Avatar
    Anjali

    Worked for me. I am using a word document in onedrive instead of sharepoint. Is there a way to edit the embedded document inside another webpage?

    1. johnhuangtesting Avatar
      johnhuangtesting

      it’s working only for certain browsers. For example, won’t work on safari/chrome on mobile. not working on safari Mac, but works on Mac chrome and firefox.

      1. Sam McNeill Avatar
        Sam McNeill

        Thanks for the feedback,
        It’s been a while since I looked into this feature.

  8. Michael Dyer Avatar
    Michael Dyer

    I still seem to be having issues with this I am trying to imbed a png image for a signature and a few other icons. I read very little HTML so I have mostly used word to design a signature but now need to upload it to a program that only accepts html code. Below is the code for an image that sits apart from the tables I have used for the signature.

  9. jam00782 Avatar

    This works good for documents, but is there any way for embedding videos? Help 🙁

    1. Sam McNeill Avatar
      Sam McNeill

      Stream videos can be embedded by they’re still only visible for internal users I believe. Check the documentation here: https://docs.microsoft.com/en-us/stream/portal-embed-video

  10. A_Grateful_Sysadmin Avatar
    A_Grateful_Sysadmin

    The built-in “Embed” feature in Excel Online did not work. It produced a “Refused to connect message” instead of showing the emebdded file on all browsers. Your solution resolved my issue. Thank you SO much.

I am always keen to discuss what I've written and hear your ideas so leave a reply here…

Discover more from SamuelMcNeill.com

Subscribe now to keep reading and get access to the full archive.

Continue reading