Sunday, December 2, 2012

Add Youtube widget to Sharepoint site using OTB Content editor web part

In the previous post I showed how to add Twitter widget to the Sharepoint site using only OTB Sharepoint features. In this article I will show how to add widget for another popular service – Youtube. The idea is the same – we will use Content editor web part and file with widget code uploaded to the document library. We need to use external file because Content editor will trim javascript code if you will put it to the web part directly.

First of all we need to find appropriate widget. From those widgets which I saw, the following was the most suitable: Youtube gadget. This is Google module which was developed by one of the Google employees (I found only “Mark L” name in the module’s metadata), but I’m not 100% sure in it, see below. Before to use it you should keep in mind the following disclaimer from Google which is shown in the bottom part of the page:

Much of the content in this directory was developed by other companies or by Google's users, not by Google. Google makes no promises or representations about its performance, quality, or content. Google doesn't charge for inclusion in this directory or accept payment for better placement.

Also I should warn you that I made conclusion that Mark L is Google’s employee only based on the metadata of the module which can be found here: as it contains the following field:


I’m not sure does Google verifies this info or not, so use it at your own risk. Anyway if you will check module’s code (in the link above), you will see that all used js files are from Google.

Ok, first step is to specify Title and Channel:


After that click Get the code button below and copy html code from the text field:


Save the copied code to the local file with .txt extension, e.g. youtube.txt. After that perform the same steps which are described in the post about Twitter widget. I.e. upload file to the doclib, ensure that it is published with major version and approved, add Content editor web part to the page and put url of the uploaded file in the Content link web part property. After that you should see Youtube channel in your Sharepoint site:


Save the page and enjoy.

No comments:

Post a Comment