A Youtube Connector for Sitecore Media Framework Part 3 – Branch and Command Templates

This is the last part of the template creation and configuration. This should be a short post too. In the next part we will dive into some exciting coding. I will be blogging about Google OAuth authentication for accessing my youtube channel. But, let’s get done with the painful part, which ends in this 3rd part of the blog.

First of all, I have to create a branch template for the account creation. Why branch template? When I create a Youtube Account item, I want to create the whole hierarchy under that. The Account Item structure should look like below

Media Framework
    |_MyYoutubeVideos Account
      |_Media Content

Here is the branch template that I created for generating above Item structure. The ‘Media Content’ folder is configured as Bucket. It will store the Video and Playlist items. The Player folder will contain different types of player available for the Account created from this branch template. Setting contains the default settings for the Account.

Sitecore Media Framework

The Account Item from the above branch template will be created through a command template. Below is the command template and the corresponding command.

Sitecore Media Framework

There are two parameters passed to this command, the Id of the branch template and Id of the  ‘/sitecore/system/Modules/Media Framework/Settings/MyYoutubeVideos Account Settings’. When I will add the account in ‘/sitecore/media library/Media Framework/Accounts’ using the command template, it will run the Execute method from Sitecore.MediaFramework.Commands.CreateAccount class as seen in the Sitecore.MediaFramework.config.

Let’s add an insert option rule for the account creation. When I select the Accounts folder in ‘/sitecore/media library/Media Framework’ I want to see what type of item can be created. Following is Insert Option rule needed for this purpose.

Sitecore Media Framework

As a result of this, when I select the Accounts folder in ‘/sitecore/media library/Media Framework’, it shows me that, I can create item from ‘MyYoutueVideos Account’ command template.


Similar to above insert options rule, I can create rules for other folders. For example, I can create rule for ‘Media Content’ folder, where  user can create videos and playlists.

I am done with all templates and configuration, let’s create the new account under ‘/sitecore/media library/Media Framework/Accounts’. And, here how it looks.

Sitecore Media Framework

That ClientId and ClientSecret will be filled up in the next post, when I will discuss about the Google OAuth authentication.

Almost done. I just want to create one more rule, so that, ‘Import All’ command button I created in the first blog post only shows up when I select the above ‘MyYoutubeVideos Account’ folder, because, that’s where I will be importing the videos and playlists. Here is the rule. This is a CommandStateRule.

Sitecore Media Framework

That ends the part 3 of the blog. Next blog I will  write about Google OAuth authentication from Sitecore.


About Himadri Chakrabarti

I am a solutions architect and a Sitecore MVP. I am focused on Sitecore and Ecommerce development. Opinions expressed in my blogs are my own.
This entry was posted in Media Framework, Sitecore and tagged , . Bookmark the permalink.

1 Response to A Youtube Connector for Sitecore Media Framework Part 3 – Branch and Command Templates

  1. WoW! Du hast hier ein echt interessantes Thema ausgesucht.
    Macht echt spaß diesen Artikel zu lesen.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.