In this article I am going to explain and show you how to create and customize the theme with the help of PowerPoint and apply it in the SharePoint Site. I also demonstrate how to apply the theme programmatically in SharePoint.
Follow these steps to create a Theme:
- Open Microsoft PowerPoint 2010.
- Go to Design Tab.
- Click the drop down arrow in colors.
- Click on "Create New Theme Colors".
- Choose the Theme colors as per your requirement.
- · Enter the Name and click on Save.
- Go to File =>Save As type.
- Enter File Name as MyTheme.
- Choose Office Theme in Save As Type.
- Click on Save.
- Open the SharePoint Site.
- Go to Site Actions =>Site Settings => Galleries => Themes.
· Click Add new item and browse your theme and add the theme file that we have created.
After adding a theme you have to apply it in the SharePoint Server:
· Go to Site Actions => Site Settings => Look and Feel => Site Theme.
· Select the theme which we have created and Click on Apply to apply the theme in the SharePoint Server.
The sites look like the following:
Now you have to apply the theme programmatically in the SharePoint Site:
1) Open Visual Studio and create a Console Application.
Write the below code in the Program.cs file:
using System;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using System.Collections.ObjectModel;
namespace ApplyThemeinSharePoint
{
class Program
{
static void Main(string[] args)
{
using (SPSite objSite = new SPSite("http://rohit:34143/"))
{
using (SPWeb objWeb = objSite.OpenWeb())
{
ReadOnlyCollection<ThmxTheme> objThemeList;
objThemeList = ThmxTheme.GetManagedThemes(objSite);
foreach(ThmxTheme objThmx in objThemeList)
{
if (objThmx.Name == "Berry")
{
ThmxTheme.SetThemeUrlForWeb(objWeb,
objThmx.ServerRelativeUrl);
break;
}
}
}
}
Console.WriteLine("Berry Theme applied in the SharePoint Site");
}
}
}
Output:
Now you can see in your SharePoint site Berry Theme is applied. Now the site looks like the following:
Thanks for reading this article. After reading this article you can easily create the theme with help of PowerPoint and can also apply the theme in the SharePoint site.
Anonymous User
26-Dec-2011Hi Rohit,
Very informative article. Its really helped me lot.
Thanks
Anonymous User
26-Dec-2011James Smith
26-Dec-2011Its really useful.