SharePoint likes to keep code safe and when adding embedded code SharePoint takes a look and decides whether or not to it likes it. And a good example of this is YouTube content.
SharePoint being safe
When we navigate to our SharePoint we select the Edit site button and then click on HTML and select Edit HTML Source.
I’ve selected a video from YouTube and have copied the embedded code. I’m now going to paste this code into the window that opened up.
When we select OK to save this code and expect the YouTube video to load on our page we get this yellow warning message appear and then disappear very quickly and the YouTube video appears on our page.
When we click save to save the page the YouTube video disappears and when we go and check the HTML Source it is now completely empty.
Embedding code to SharePoint
There are many ways to resolve this issue and one of these includes stopping SharePoint from removing the embedded code but this isn’t realistic.
Instead we are going to save the content of the embedded code to a text file, upload it and then use a web part to pull this information viewing it as HTML and loading the content.
Open notepad and paste the embedded code into it.
Save the file and upload the file into SharePoint. A good place would be the SiteAssets library.
Add a content editor web part to your page and edit the web part.
In the properties box down the right hand side you will see 3 dots, click on these to open up a new windows.
Paste the URL of the text file we uploaded and click OK
When you now save your SharePoint page you will always have your embedded code.
This doesn’t necessarily have to be a YouTube video. It could be flash code, html code or any other embeddable code.
17 thoughts on “Embed YouTube and other code into SharePoint 2010”
Thanks for the article Alex. I was giving it a try and everyting was working except when I tried to save the page. Now the page is locked in edit mode except I cannot edit anything. Do you have any suggestions? Thanks
Hi, hard to tell unless you can give full description of everything on you pages ;-).
Try doing it through SharePoint Designer or try a different browser.
So easy, and it worked perfectly. Great solution! Thanks!
How to embed the youtube in SharePoint 2010 blogs? it is disappearing after publishing the post.
Does the content editor web part get deleted too?
I’m pulling my hair out trying to embed videos into my blog (no webpart available). You mentioned “…There are many ways to resolve this issue and one of these includes stopping SharePoint from removing the embedded code but this isn’t realistic…”
Please, please can you tell/link me to how to do this? (I’ll take it as read that this is something you should never ever do etc)
I just used these instructions to get a video on the SIMS Learning gateway. Worked first time. Superb and saved me a lot of time – now this is the way to go!
This doesn’t answer how to embed a video into a Sharepoint Blog. You can’t insert web parts into a blog posting.
steve you are correct, it does not solve the issue within blod posts
This is a great approach to help solve an aggravating issue that’s just about had me tied in knots… Thank you!!
Great post! but is there a way to publish the embed code into a blog post or news article page? I’ve been trying to embed flickr code and it was driving me nuts.
All I can think to do is link to the flickr page to view the slideshow but I don’t really want to point people away from our site.
Is there any way to embed the code? or how do you turn off the embedding within sharepoint? or is that not advisable?
Any help you can provide, I’m sure my remaining hair would be very grateful!
Very helpful. Our district starting using Sharepoint 2010 and this was exactly what I needed. Awesome. Thanks!
Our school uses SharePoint 2007 for our school websites. The issue is that they are all https sites, when I followed your steps I can see the video coming up in my page. My students however cannot. Is there a way around this?
please help, i cant find content editor 🙁