Skip to content

Instantly share code, notes, and snippets.

@vman
Created January 21, 2012 08:02
Show Gist options
  • Save vman/1651977 to your computer and use it in GitHub Desktop.
Save vman/1651977 to your computer and use it in GitHub Desktop.
Custom Action for CSS
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
//Add the Css to the current Web
SPSite site = properties.Feature.Parent as SPSite;
SPWeb web = site.OpenWeb();
if (web.ServerRelativeUrl == "/")
{
web.AlternateCssUrl = web.ServerRelativeUrl + "SiteAssets/Styles/mystyles.css";
}
else
{
web.AlternateCssUrl = web.ServerRelativeUrl + "/SiteAssets/Styles/mystyles.css";
}
web.Update();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment