/** * * SPWeb model assembly example * */ public static WebModelNode WebDemoModel() { return(SPMeta2Model.NewWebModel(Web => { Web .AddWelcomePage(new WelcomePageDefinition { Url = ListsInfo.Contacts().CustomUrl }) .AddWebFeature(FeaturesInfo.DisableMinimalDownloadStrategy) .AddField(FieldsInfo.Email()) .AddField(FieldsInfo.PhoneNumber()) .AddField(FieldsInfo.EmployeesCount()) .AddField(FieldsInfo.Owner()) .AddField(FieldsInfo.Function()) .AddContentType(ContentTypesInfo.Contact(), contentType => { contentType .AddContentTypeFieldLink(new ContentTypeFieldLinkDefinition { FieldId = BuiltInFieldId.Title, DisplayName = "Name", Required = true }) .AddContentTypeFieldLink(FieldsInfo.Email()) .AddContentTypeFieldLink(FieldsInfo.PhoneNumber()) ; }) .AddContentType(ContentTypesInfo.Function(), contentType => { contentType .AddContentTypeFieldLink(FieldsInfo.Owner()) .AddContentTypeFieldLink(FieldsInfo.EmployeesCount()) ; }) .AddContentType(ContentTypesInfo.SubFunction(), contentType => { contentType .AddContentTypeFieldLink(FieldsInfo.Function()) .AddContentTypeFieldLink(FieldsInfo.Owner()) ; }) .AddList(ListsInfo.Contacts(), List => { List .AddRemoveStandardContentTypes() .AddContentTypeLink(ContentTypesInfo.Contact()) .AddListView(ViewsInfo.ContactsView()) ; }) .AddList(ListsInfo.Functions(), List => { List .AddRemoveStandardContentTypes() .AddContentTypeLink(ContentTypesInfo.Function()) .AddListView(ViewsInfo.FunctionsView()) ; }) .AddList(ListsInfo.SubFunctions(), List => { List .AddRemoveStandardContentTypes() .AddContentTypeLink(ContentTypesInfo.SubFunction()) .AddListView(ViewsInfo.SubFunctionsView()) ; }) ; })); }
public static ListModelNode ImportFunctionsItems(this ListModelNode node) { var FunctionsPath = Path.Combine(ConstsInfo.SystemPath, ConstsInfo.FunctionsImportPath); return(node.ImportItemsFromFile(ContentTypesInfo.Function().GetContentTypeId(), FunctionsPath)); }