本文整理汇总了C#中Web.GetCustomActions方法的典型用法代码示例。如果您正苦于以下问题:C# Web.GetCustomActions方法的具体用法?C# Web.GetCustomActions怎么用?C# Web.GetCustomActions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Web
的用法示例。
在下文中一共展示了Web.GetCustomActions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateEntities
public override ProvisioningTemplate CreateEntities(Web web, ProvisioningTemplate template, ProvisioningTemplateCreationInformation creationInfo)
{
var context = web.Context as ClientContext;
bool isSubSite = web.IsSubSite();
var webCustomActions = web.GetCustomActions();
var siteCustomActions = context.Site.GetCustomActions();
var customActions = new CustomActions();
foreach (var customAction in webCustomActions)
{
customActions.WebCustomActions.Add(CopyUserCustomAction(customAction));
}
// if this is a sub site then we're not creating entities for site collection scoped custom actions
if (!isSubSite)
{
foreach (var customAction in siteCustomActions)
{
customActions.SiteCustomActions.Add(CopyUserCustomAction(customAction));
}
}
template.CustomActions = customActions;
// If a base template is specified then use that one to "cleanup" the generated template model
if (creationInfo.BaseTemplate != null)
{
template = CleanupEntities(template, creationInfo.BaseTemplate, isSubSite);
}
return template;
}
示例2: ExtractObjects
public override ProvisioningTemplate ExtractObjects(Web web, ProvisioningTemplate template, ProvisioningTemplateCreationInformation creationInfo)
{
using (var scope = new PnPMonitoredScope(CoreResources.Provisioning_ObjectHandlers_CustomActions))
{
var context = web.Context as ClientContext;
bool isSubSite = web.IsSubSite();
var webCustomActions = web.GetCustomActions();
var siteCustomActions = context.Site.GetCustomActions();
var customActions = new CustomActions();
foreach (var customAction in webCustomActions)
{
scope.LogDebug(CoreResources.Provisioning_ObjectHandlers_CustomActions_Adding_web_scoped_custom_action___0___to_template, customAction.Name);
customActions.WebCustomActions.Add(CopyUserCustomAction(customAction));
}
// if this is a sub site then we're not creating entities for site collection scoped custom actions
if (!isSubSite)
{
foreach (var customAction in siteCustomActions)
{
scope.LogDebug(CoreResources.Provisioning_ObjectHandlers_CustomActions_Adding_site_scoped_custom_action___0___to_template, customAction.Name);
customActions.SiteCustomActions.Add(CopyUserCustomAction(customAction));
}
}
template.CustomActions = customActions;
// If a base template is specified then use that one to "cleanup" the generated template model
if (creationInfo.BaseTemplate != null)
{
template = CleanupEntities(template, creationInfo.BaseTemplate, isSubSite, scope);
}
}
return template;
}
示例3: WillExtract
public override bool WillExtract(Web web, ProvisioningTemplate template, ProvisioningTemplateCreationInformation creationInfo)
{
if (!_willExtract.HasValue)
{
var context = web.Context as ClientContext;
var webCustomActions = web.GetCustomActions();
var siteCustomActions = context.Site.GetCustomActions();
_willExtract = webCustomActions.Any() || siteCustomActions.Any();
}
return _willExtract.Value;
}