Change SharePoint 2013 sub-site color programmatically

2k Views Asked by At

I have a main site collection that is using the stock Publishing Site template in red. All sub-sites are inheriting the master page and theme. All sub-sites are using the Project Site template. I am creating these using the Server Object Model. All the sub-sites are the standard blue after creation. How can I force them to be red?

static void SetupNewSubSite(int currentYear, SPItemEventProperties properties, int siteIndexId)
{
    string description = properties.AfterProperties["Project_x0020_Description"].ToString();
    SPListItem CurrentItem = properties.ListItem;
    String subSiteUrl = Convert.ToString(siteIndexId);
    SPSite projectSiteCollection = new SPSite(properties.Web.Site.Url + "/" + currentYear);           
    SPWeb sWeb = new SPSite(properties.SiteId).OpenWeb(properties.RelativeWebUrl);            
    SPWeb oWeb = projectSiteCollection.RootWeb;
    SPWebCollection cWebs = oWeb.Webs;
    SPWeb xWeb = cWebs.Add(subSiteUrl, properties.AfterProperties["Title"].ToString(),
    properties.AfterProperties["Project_x0020_Description"].ToString(), 1033, "{B5B6BDD1-485A-44BC-B093-F1048271C49D}", false, false);
}
0

There are 0 best solutions below