Recently I had the requirement to embed an external website onto a modern page on a SharePoint Online site. Fine, that’s no problem at all. This is available out-of-the-box on a modern page, right?

Embedding external content in an Office 365 Group / SharePoint Online site

Let’s proceed by providing the external content’s URL in the properties of the webpart.

Embedding external content in an Office 365 Group / SharePoint Online site

The error message reads: This website doesn’t support embedding using just the address. Try pasting the embed code instead. If it’s important to embed from this site using just the address, please send us feedback.

Fair enough, let me try by adding an HTML iframe-tag.

Embedding external content in an Office 365 Group / SharePoint Online site

The error message reads: Embedding content from this website isn’t allowed, but your admin can change this setting. They will need to add ‘www.laurentschoenaers.be’ to the list of sites that are allowed.

I clicked the guidance url, that lead me to a Microsoft Office support page.
At this point you need to add the URL to the external content in the HTML Field Security, through Site Settings. If the link is not there, scripting might be turned off. This is turned on on the tenant I’m working, so no problem right?

I wouldn’t be writing this post if everything went as expected, isn’t it? 🙂

Embedding external content in an Office 365 Group / SharePoint Online site

As you could already expect, no HTML Field Security to be found in the settings of this site. Great! Navigating to the URL (https://[tenant].sharepoint.com/sites/[site]/_layouts/15/htmlfieldsecurity.aspx) gives an “Sorry, you don’t have access to this page” error.

Embedding external content in an Office 365 Group / SharePoint Online site

Luckily for us we have PowerShell to fix this one.

Connect-SPOService -URL https://[tenant]-admin.sharepoint.com
Set-SPOSite https://[tenant].sharepoint.com/sites/[site] -DenyAddAndCustomizePages $false

By executing this script, the HTML Field Security link becomes visible and accessible from the site settings.

Embedding external content in an Office 365 Group / SharePoint Online site

We can now add our domain to use as external content in a SharePoint Online site or an Office 365 Group.

Embedding external content in an Office 365 Group / SharePoint Online site

There we go.

Embedding external content in an Office 365 Group / SharePoint Online site