public void InjectModelsToDefinition(WebModelNode webDefinition) { webDefinition.AddFields(FieldDefnitions); webDefinition.AddContentType(ContentTypeDefinition, contentType => { contentType .AddContentTypeFieldLinks(FieldDefnitions) .AddUniqueContentTypeFieldsOrder(new UniqueContentTypeFieldsOrderDefinition { Fields = FieldLinkValues() }); }); webDefinition.AddList(this.getListDefinition(), list => { list .AddContentTypeLink(ContentTypeDefinition) .AddUniqueContentTypeOrder(new UniqueContentTypeOrderDefinition { ContentTypes = new List <ContentTypeLinkValue> { new ContentTypeLinkValue { ContentTypeName = ContentTypeDefinition.Name }, } }) ; }); }
protected void AddListWorkflow(WebModelNode web) { var workflow = ModelGeneratorService.GetRandomDefinition <SP2013WorkflowDefinition>(); var workflowEnableList = ModelGeneratorService.GetRandomDefinition <ListDefinition>(); var historyList = GetHistoryList(); var taskList = GetTaskList(); web .AddList(historyList) .AddList(taskList) .AddList(workflowEnableList, list => { list.AddSP2013WorkflowSubscription(new SP2013WorkflowSubscriptionDefinition { Name = Rnd.String(), WorkflowDisplayName = workflow.DisplayName, #pragma warning disable 618 HistoryListUrl = historyList.GetListUrl(), TaskListUrl = taskList.GetListUrl() #pragma warning restore 618 }); }) .AddSP2013Workflow(workflow); }
private WebModelNode GetWebContainersModel(WebModelNode model, Collection <ModelNode> childModels) { foreach (ModelNode modelNode in childModels) { if (modelNode.Value.GetType() == typeof(WebDefinition)) { model.AddWeb((WebDefinition)modelNode.Value, currentWeb => { GetWebContainersModel(currentWeb, modelNode.ChildModels); }); } if (modelNode.Value.GetType() == typeof(ListDefinition)) { model.AddList((ListDefinition)modelNode.Value); } } return(model); }
protected void AddWebWorkflow(WebModelNode web) { var workflow = ModelGeneratorService.GetRandomDefinition <SP2013WorkflowDefinition>(); var historyList = GetHistoryList(); var taskList = GetTaskList(); web .AddList(historyList) .AddList(taskList) .AddSP2013Workflow(workflow) .AddSP2013WorkflowSubscription(new SP2013WorkflowSubscriptionDefinition { Name = Rnd.String(), WorkflowDisplayName = workflow.DisplayName, HistoryListUrl = historyList.GetListUrl(), TaskListUrl = taskList.GetListUrl() }); }
private WebModelNode GetContainersModel(WebModelNode model) { WebModelNode containersModel = SPMeta2Model.NewWebModel(); foreach (ModelNode modelNode in model.ChildModels) { if (modelNode.Value.GetType() == typeof(WebDefinition)) { containersModel.AddWeb((WebDefinition)modelNode.Value, currentWeb => { GetWebContainersModel(currentWeb, modelNode.ChildModels); }); } if (modelNode.Value.GetType() == typeof(ListDefinition)) { containersModel.AddList((ListDefinition)modelNode.Value); } } return(containersModel); }
// Add new list method public static WebModelNode AddSampleList(this WebModelNode node) { node .AddList(List(), currentList => { currentList .AddContentTypeLink(SampleCTCT.ContentType()) .AddRemoveContentTypeLinks(new RemoveContentTypeLinksDefinition { ContentTypes = new List <ContentTypeLinkValue> { new ContentTypeLinkValue { ContentTypeId = BuiltInContentTypeId.Item } } }) .AddListView(AllItems()) ; }); return(node); }
protected void AddWebWorkflow(WebModelNode web) { var workflow = ModelGeneratorService.GetRandomDefinition<SP2013WorkflowDefinition>(); var historyList = GetHistoryList(); var taskList = GetTaskList(); web .AddList(historyList) .AddList(taskList) .AddSP2013Workflow(workflow) .AddSP2013WorkflowSubscription(new SP2013WorkflowSubscriptionDefinition { Name = Rnd.String(), WorkflowDisplayName = workflow.DisplayName, HistoryListUrl = historyList.GetListUrl(), TaskListUrl = taskList.GetListUrl() }); }
private static void setupWeb(WebModelNode web, bool AddNintex = false) { web.AddNintexWorkflowO365(webWorkflow, workflowModel => { #region Events workflowModel.OnProvisioning <Object> (spMetaCtx => { Console.WriteLine("About to provision the workflow on the web"); }); workflowModel.OnProvisioned <NintexO365HandlerOnProvisionedEvent> (spMetaCtx => { Console.WriteLine("Provisoined the workflow for {0}", ((NintexWebWorkflowO365Definition)spMetaCtx.ObjectDefinition).Name); var result = spMetaCtx.Object; if (result.saveResponse != null) { Console.WriteLine("The result of save is {0}", result.saveResponse.Content.ReadAsStringAsync().Result); } if (result.puiblishResponse != null) { Console.WriteLine("The result of publish is {0}", result.puiblishResponse.Content.ReadAsStringAsync().Result); } if (result.assignedUseForProductionValue != null) { Console.WriteLine("The result of assigned use is {0}", result.assignedUseForProductionValue.Content.ReadAsStringAsync().Result); } }); #endregion }); web.AddList(TestList, list => { list.AddContentTypeLink(BuiltInContentTypeId.Issue); // this refers to SPMeta2.NintexExt.Core.Syntax.Default; if (AddNintex) { list.AddNintexFormO365(form, formmodel => { #region Events formmodel.OnProvisioning <Object> (spMetaCtx => { Console.WriteLine("About to provision the form for {0}", ((NintexFormO365Definition)spMetaCtx.ObjectDefinition).ListContentTypeNameOrId); }); formmodel.OnProvisioned <NintexO365HandlerOnProvisionedEvent> (spMetaCtx => { Console.WriteLine("Provisoined the form for {0}", ((NintexFormO365Definition)spMetaCtx.ObjectDefinition).ListContentTypeNameOrId); var result = spMetaCtx.Object; if (result.saveResponse != null) { Console.WriteLine("The result of save is {0}", result.saveResponse.Content.ReadAsStringAsync().Result); } if (result.puiblishResponse != null) { Console.WriteLine("The result of publish is {0}", result.puiblishResponse.Content.ReadAsStringAsync().Result); } if (result.assignedUseForProductionValue != null) { Console.WriteLine("The result of assigned use is {0}", result.assignedUseForProductionValue.Content.ReadAsStringAsync().Result); } }); #endregion }); // if you do not use the syntax default, you can use the line below //list.AddDefinitionNode(form); list.AddNintexWorkflowO365(listWorkflow, listWorkflow => { #region Events listWorkflow.OnProvisioning <Object> (spMetaCtx => { Console.WriteLine("About to provision the list workflow"); }); listWorkflow.OnProvisioned <Object> (spMetaCtx => { Console.WriteLine("Provisoined the list workflow"); }); //TODO: //listWorkflow.OnProvisioned<NintexFormO365HandlerOnProvisionedEvent> // (spMetaCtx => // { // Console.WriteLine("Provisoined the workflow m for {0}", ((NintexFormO365Definition)spMetaCtx.ObjectDefinition).ListContentTypeNameOrId); // var result = spMetaCtx.Object; // if (result.saveResponse != null) // { // Console.WriteLine("The result of save is {0}", result.saveResponse.Content.ReadAsStringAsync().Result); // } // if (result.puiblishResponse != null) // { // Console.WriteLine("The result of publish is {0}", result.puiblishResponse.Content.ReadAsStringAsync().Result); // } // if (result.assignedUseForProductionValue != null) // { // Console.WriteLine("The result of assigned use is {0}", result.assignedUseForProductionValue.Content.ReadAsStringAsync().Result); // } // }); #endregion }); } }); // same here, same list, testing that it works when the list is already there web.AddHostList(TestList, list => { if (AddNintex) { // this refers to SPMeta2.NintexExt.Core.Syntax.Default; list.AddNintexFormO365(form, formmodel => { #region Events formmodel.OnProvisioning <Object> (spMetaCtx => { Console.WriteLine("About to provision the form for {0}", ((NintexFormO365Definition)spMetaCtx.ObjectDefinition).ListContentTypeNameOrId); }); formmodel.OnProvisioned <NintexO365HandlerOnProvisionedEvent> (spMetaCtx => { Console.WriteLine("Provisoined the form for {0}", ((NintexFormO365Definition)spMetaCtx.ObjectDefinition).ListContentTypeNameOrId); var result = spMetaCtx.Object; if (result.saveResponse != null) { Console.WriteLine("The result of save is {0}", result.saveResponse.Content.ReadAsStringAsync().Result); } if (result.puiblishResponse != null) { Console.WriteLine("The result of publish is {0}", result.puiblishResponse.Content.ReadAsStringAsync().Result); } if (result.assignedUseForProductionValue != null) { Console.WriteLine("The result of assigned use is {0}", result.assignedUseForProductionValue.Content.ReadAsStringAsync().Result); } }); #endregion }); // if you do not use the syntax default, you can use the line below //list.AddDefinitionNode(form); list.AddNintexWorkflowO365(listWorkflow, listWorkflow => { #region Events listWorkflow.OnProvisioning <Object> (spMetaCtx => { Console.WriteLine("About to provision the list workflow"); }); listWorkflow.OnProvisioned <NintexO365HandlerOnProvisionedEvent> (spMetaCtx => { Console.WriteLine("Provisoined the workflow m for {0}", ((NintexListWorkflowO365Definition)spMetaCtx.ObjectDefinition).Name); var result = spMetaCtx.Object; if (result.saveResponse != null) { Console.WriteLine("The result of save is {0}", result.saveResponse.Content.ReadAsStringAsync().Result); } if (result.puiblishResponse != null) { Console.WriteLine("The result of publish is {0}", result.puiblishResponse.Content.ReadAsStringAsync().Result); } if (result.assignedUseForProductionValue != null) { Console.WriteLine("The result of assigned use is {0}", result.assignedUseForProductionValue.Content.ReadAsStringAsync().Result); } }); #endregion }); } }); web.AddList(TestList2, list => { list.AddContentTypeLink(BuiltInContentTypeId.Issue); // this refers to SPMeta2.NintexExt.Core.Syntax.Default; if (AddNintex) { list.AddNintexFormO365(form2_item, formmodel => { #region Events formmodel.OnProvisioning <Object> (spMetaCtx => { Console.WriteLine("About to provision the form for {0}", ((NintexFormO365Definition)spMetaCtx.ObjectDefinition).ListContentTypeNameOrId); }); formmodel.OnProvisioned <NintexO365HandlerOnProvisionedEvent> (spMetaCtx => { Console.WriteLine("Provisoined the form for {0}", ((NintexFormO365Definition)spMetaCtx.ObjectDefinition).ListContentTypeNameOrId); var result = spMetaCtx.Object; if (result.saveResponse != null) { Console.WriteLine("The result of save is {0}", result.saveResponse.Content.ReadAsStringAsync().Result); } if (result.puiblishResponse != null) { Console.WriteLine("The result of publish is {0}", result.puiblishResponse.Content.ReadAsStringAsync().Result); } if (result.assignedUseForProductionValue != null) { Console.WriteLine("The result of assigned use is {0}", result.assignedUseForProductionValue.Content.ReadAsStringAsync().Result); } }); #endregion }); list.AddNintexFormO365(form2_issue, formmodel => { #region Events formmodel.OnProvisioning <Object> (spMetaCtx => { Console.WriteLine("About to provision the form for {0}", ((NintexFormO365Definition)spMetaCtx.ObjectDefinition).ListContentTypeNameOrId); }); formmodel.OnProvisioned <NintexO365HandlerOnProvisionedEvent> (spMetaCtx => { Console.WriteLine("Provisoined the form for {0}", ((NintexFormO365Definition)spMetaCtx.ObjectDefinition).ListContentTypeNameOrId); var result = spMetaCtx.Object; if (result.saveResponse != null) { Console.WriteLine("The result of save is {0}", result.saveResponse.Content.ReadAsStringAsync().Result); } if (result.puiblishResponse != null) { Console.WriteLine("The result of publish is {0}", result.puiblishResponse.Content.ReadAsStringAsync().Result); } if (result.assignedUseForProductionValue != null) { Console.WriteLine("The result of assigned use is {0}", result.assignedUseForProductionValue.Content.ReadAsStringAsync().Result); } }); #endregion }); list.AddNintexWorkflowO365(listWorkflow2, listWorkflow => { #region Events listWorkflow.OnProvisioning <Object> (spMetaCtx => { Console.WriteLine("About to provision the list workflow 2"); }); listWorkflow.OnProvisioned <Object> (spMetaCtx => { Console.WriteLine("Provisoined the list workflow 2"); }); #endregion }); } }); }