Example #1
0
        /**
         *
         * 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())
                    ;
                })
                ;
            }));
        }
Example #2
0
        public static ListModelNode ImportSubFunctionsItems(this ListModelNode node)
        {
            var SubFunctionsPath = Path.Combine(ConstsInfo.SystemPath, ConstsInfo.SubFunctionsImportPath);

            return(node.ImportItemsFromFile(ContentTypesInfo.SubFunction().GetContentTypeId(), SubFunctionsPath));
        }