我创建了一个已部署为功能的自定义母版页。我使用SP基础而不是SP Server。
我已激活该功能,但主页仅应用于顶级网站。有人可以让我知道我的事件接收器做错了什么。
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPSite siteCollection = properties.Feature.Parent as SPSite;
if (siteCollection != null)
{
SPWeb topLevelSite = siteCollection.RootWeb;
// Calculate relative path to site from Web Application root.
string WebAppRelativePath = topLevelSite.ServerRelativeUrl;
if (!WebAppRelativePath.EndsWith("/"))
{
WebAppRelativePath += "/";
}
// Enumerate through each site and apply branding.
foreach (SPWeb site in siteCollection.AllWebs)
{
site.MasterUrl = WebAppRelativePath + "_catalogs/masterpage/custom.master";
site.CustomMasterUrl = WebAppRelativePath + "_catalogs/masterpage/custom.master";
site.Update();
}
}
}
任何帮助都会很棒!
答案 0 :(得分:0)
我今天正在搜索此主题可能是此链接可以帮助您 http://www.beckybertram.com/oldblog/index.php?p=33&more=1&c=1&tb=1&pb=1