//[SampleMetadataTag(Name = BuiltInTagNames.SampleHidden)] public void CanDeployWelcomePageToList() { var newListHomePage = new WikiPageDefinition { FileName = "A new landing page for list.aspx", Content = "Hello, this is a new list landing page!" }; var welcomePage = new WelcomePageDefinition { // should be relating to the list! Url = newListHomePage.FileName }; var model = SPMeta2Model.NewWebModel(web => { web .AddHostList(BuiltInListDefinitions.SitePages, list => { list .AddWikiPage(newListHomePage) .AddWelcomePage(welcomePage); }); }); DeployModel(model); }
//[SampleMetadataTag(Name = BuiltInTagNames.SampleHidden)] public void CanDeployWelcomePageToWeb() { var newWebHomePage = new WikiPageDefinition { FileName = "A new landing page for web.aspx", Content = "Hello, this is a new web landing page!" }; var welcomePage = new WelcomePageDefinition { // should be relating to the web! Url = UrlUtility.CombineUrl(BuiltInListDefinitions.SitePages.GetListUrl(), newWebHomePage.FileName) }; var model = SPMeta2Model.NewWebModel(web => { web .AddHostList(BuiltInListDefinitions.SitePages, list => { list.AddWikiPage(newWebHomePage); }) .AddWelcomePage(welcomePage); }); DeployModel(model); }
public override ModelNode ReverseSingleHost(object reverseHost, ReverseOptions options) { var item = (reverseHost as WelcomePageReverseHost).HostFolder; var def = new WelcomePageDefinition(); def.Url = item.WelcomePage; return(new WelcomePageModelNode { Options = { RequireSelfProcessing = true }, Value = def }); }
//[SampleMetadataTag(Name = BuiltInTagNames.SampleHidden)] public void CanDeployWelcomePageToFolder() { var newFolderHomePage = new WikiPageDefinition { FileName = "A new landing page for folder.aspx", Content = "Hello, this is a new folder landing page!" }; var welcomePage = new WelcomePageDefinition { // should be relating to the folder! Url = newFolderHomePage.FileName }; var landingPageFolder = new FolderDefinition { Name = "A folder with custom landing page" }; var model = SPMeta2Model.NewWebModel(web => { web .AddHostList(BuiltInListDefinitions.SitePages, list => { list .AddFolder(landingPageFolder, folder => { folder .AddWikiPage(newFolderHomePage) .AddWelcomePage(welcomePage); }); }); }); DeployModel(model); }
public static ModelNode AddWelcomePage(this ModelNode model, WelcomePageDefinition definition, Action <ModelNode> action) { return(model.AddDefinitionNode(definition, action)); }
public static ModelNode AddWelcomePage(this ModelNode model, WelcomePageDefinition definition) { return(AddWelcomePage(model, definition, null)); }
public static TModelNode AddWelcomePage <TModelNode>(this TModelNode model, WelcomePageDefinition definition, Action <WelcomePageModelNode> action) where TModelNode : ModelNode, IWelcomePageHostModelNode, new() { return(model.AddTypedDefinitionNode(definition, action)); }
public static TModelNode AddWelcomePage <TModelNode>(this TModelNode model, WelcomePageDefinition definition) where TModelNode : ModelNode, IWelcomePageHostModelNode, new() { return(AddWelcomePage(model, definition, null)); }
private void DeployWelcomePage(object modelHost, DefinitionBase model, SPFolder folder, WelcomePageDefinition welcomePgaeModel) { InvokeOnModelEvent(this, new ModelEventArgs { CurrentModelNode = null, Model = null, EventType = ModelEventType.OnProvisioning, Object = folder, ObjectType = typeof(SPFolder), ObjectDefinition = welcomePgaeModel, ModelHost = modelHost }); TraceService.VerboseFormat((int)LogEventId.ModelProvisionCoreCall, "Changing welcome page to: [{0}]", welcomePgaeModel.Url); // https://github.com/SubPointSolutions/spmeta2/issues/431 folder.WelcomePage = UrlUtility.RemoveStartingSlash(welcomePgaeModel.Url); InvokeOnModelEvent(this, new ModelEventArgs { CurrentModelNode = null, Model = null, EventType = ModelEventType.OnProvisioned, Object = folder, ObjectType = typeof(SPFolder), ObjectDefinition = welcomePgaeModel, ModelHost = modelHost }); folder.Update(); }
private void DeployWelcomePage(object modelHost, DefinitionBase model, SPFolder folder, WelcomePageDefinition welcomePgaeModel) { InvokeOnModelEvent(this, new ModelEventArgs { CurrentModelNode = null, Model = null, EventType = ModelEventType.OnProvisioning, Object = folder, ObjectType = typeof(SPFolder), ObjectDefinition = welcomePgaeModel, ModelHost = modelHost }); TraceService.VerboseFormat((int)LogEventId.ModelProvisionCoreCall, "Changing welcome page to: [{0}]", welcomePgaeModel.Url); folder.WelcomePage = welcomePgaeModel.Url; InvokeOnModelEvent(this, new ModelEventArgs { CurrentModelNode = null, Model = null, EventType = ModelEventType.OnProvisioned, Object = folder, ObjectType = typeof(SPFolder), ObjectDefinition = welcomePgaeModel, ModelHost = modelHost }); folder.Update(); }
private void DeployWelcomePage(object modelHost, DefinitionBase model, Folder folder, WelcomePageDefinition welcomePgaeModel) { var context = folder.Context; context.Load(folder); context.ExecuteQueryWithTrace(); InvokeOnModelEvent(this, new ModelEventArgs { CurrentModelNode = null, Model = null, EventType = ModelEventType.OnProvisioning, Object = folder, ObjectType = typeof(Folder), ObjectDefinition = welcomePgaeModel, ModelHost = modelHost }); TraceService.VerboseFormat((int)LogEventId.ModelProvisionCoreCall, "Changing welcome page to: [{0}]", welcomePgaeModel.Url); // Enhance 'WelcomePageDefinition' - handle / in Url prop #431 // https://github.com/SubPointSolutions/spmeta2/issues/431 folder.WelcomePage = UrlUtility.RemoveStartingSlash(welcomePgaeModel.Url); InvokeOnModelEvent(this, new ModelEventArgs { CurrentModelNode = null, Model = null, EventType = ModelEventType.OnProvisioned, Object = folder, ObjectType = typeof(Folder), ObjectDefinition = welcomePgaeModel, ModelHost = modelHost }); TraceService.Verbose((int)LogEventId.ModelProvisionCoreCall, "Calling folder.Update()"); folder.Update(); context.ExecuteQueryWithTrace(); }