コード例 #1
0
        // Uncomment the method below to handle the event raised after a feature has been activated.

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            ArtDevFeature feature = new ArtDevFeature(properties);

            ArtDevField FieldMenu2Level      = feature.CreateFieldText("Menu2Level").SetTitle("Меню второго уровня");
            ArtDevField FieldMenuLink        = feature.CreateFieldText("MenuLink").SetTitle("Ссылка в меню");
            ArtDevField FieldMenuOrderNumber = feature.CreateFieldNumber("MenuOrderNumber").SetTitle("Порядковый номер");


            feature.CreateList("ArtDevHeaderMenu").SetListTitle("ArtDev меню")
            .GetFieldLink(SPBuiltInFieldId.Title).SetFieldTitle("Меню первого уровня").SetFieldRequired(true).Commit()
            .AddFieldLink(FieldMenu2Level).SetFieldRequired(false).Commit()
            .AddFieldLink(FieldMenuLink).Commit()
            .AddFieldLink(FieldMenuOrderNumber).SetFieldRequired(false).Commit()
            .CreateListView("VewTable", true)
            .ClearItemsIfModeDev()
            .AddItemIfModeDevOrFirstDeploy("Home", "", "/", "1")
            .AddItemIfModeDevOrFirstDeploy("Jobs", "", "#", "2")
            .AddItemIfModeDevOrFirstDeploy("Candidates", "", "#", "3")
            .AddItemIfModeDevOrFirstDeploy("Employers", "", "#", "4")
            .AddItemIfModeDevOrFirstDeploy("Blog", "", "#", "5")
            .AddItemIfModeDevOrFirstDeploy("Pages", "", "#", "6")
            .AddItemIfModeDevOrFirstDeploy("Home", "Header layout 1", "index.html", "1")
            .AddItemIfModeDevOrFirstDeploy("Home", "Header layout 2", "index2.html", "2")
            .AddItemIfModeDevOrFirstDeploy("Home", "Header layout 3", "index3.html", "3")
            .AddItemIfModeDevOrFirstDeploy("Home", "Header layout 4", "index4.html", "4")
            ;

            ArtDevList ArtDevSitePagesLibrary = feature.CreateDocumentLibrary("ArtDevPages")
                                                .SetListTitle("ArtDev Страницы")
                                                .RemoveStandartContentType()
                                                .addContentType(SPBuiltInContentTypeId.WebPartPage)
                                                .addContentType(SPBuiltInContentTypeId.WikiDocument);
        }
コード例 #2
0
        // Uncomment the method below to handle the event raised after a feature has been activated.

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            ArtDevFeature feature     = new ArtDevFeature(properties);
            ArtDevList    ListAddress = feature.CreateList("ArtDevAddressEmp").SetListTitle("ArtDev Адреса")
                                        .GetFieldLink(SPBuiltInFieldId.Title).SetFieldTitle("Адрес").Commit()
                                        .AddOrUpdateItem("Москва, Ул. Маршала Воронова, 2а")
                                        .AddOrUpdateItem("Нижний Новгород, Авангардная, 11")
                                        .AddOrUpdateItem("Нижний Новгород, Тихорецкая, 10");

            ArtDevField FieldAddress = feature.CreateFieldLookup("FieldAddress", ListAddress.list.RootFolder.Url)
                                       .SetTitle("Адрес").SetLookupField("Title");
            ArtDevField FieldComment = feature.CreateFieldMultiLineText("Comment")
                                       .SetTitle("Комментарий");

            ArtDevList ListEmployee = feature.CreateList("ArtDevEmployee").SetListTitle("ArtDev сотрудники")
                                      .GetFieldLink(SPBuiltInFieldId.Title).SetFieldTitle("ФИО").Commit()
                                      .AddFieldLink(SPBuiltInFieldId.JobTitle).SetFieldTitle("Должность").Commit()
                                      .AddFieldLink(FieldAddress).Commit()
                                      .AddFieldLink(FieldComment).Commit()
                                      .AddOrUpdateItem("Иванов Иван Иванович", "Директор2")
                                      .AddOrUpdateItem("Петров Петр Петрович", "Бухгалтер")
                                      .AddOrUpdateItem("Сидоров Сидр Сидорович", "Рабочий");
        }
コード例 #3
0
        // Uncomment the method below to handle the event raised after a feature has been activated.

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            ArtDevFeature Feature = new ArtDevFeature(properties);

            //Amount
            ArtDevField amountField = Feature.CreateFieldCurrency("Amount")
                                      .SetTitle("Количество")
                                      .SetDisplayFormat(SPNumberFormatTypes.TwoDecimals)
                                      .SetMinimumValue(0);

            // Client Name
            ArtDevField clientField = Feature.CreateFieldText("ClientName")
                                      .SetTitle("Имя Клиента");

            // Date Opened
            ArtDevField dateOpenedField = Feature.CreateFieldDateTime("DateOpened")
                                          .SetTitle("Дата открытия")
                                          .SetDisplayFormat(SPDateTimeFieldFormatType.DateOnly)
                                          .SetDefaultValue("[today]");

            // Cost Center Name
            ArtDevField costCenterField = Feature.CreateFieldChoice("CostCenter")
                                          .SetChoices("Administration", "Information Services", "Facilities", "Operations", "Sales", "Marketing")
                                          .SetTitle("Центр затрат");

            ArtDevField EmployeeField = Feature.CreateFieldUser("FIOEmployee")
                                        .SetTitle("ФИО Сотрудников").SetMultipleValue(false);

            ArtDevField ActiveSiteField = Feature.CreateFieldLookup("ActiveSite", "SiteAssets")
                                          .SetTitle("Активы сайта").SetMultipleValue(false).SetLookupField("Title");

            ArtDevField SettingValueField = Feature.CreateFieldText("SettingValue")
                                            .SetTitle("Значение");


            /* CREATE SITE CONTENT TYPES */

            // Create the Financial Document
            ArtDevContentType financialDocumentCType = Feature.CreateContentType("Financial Document", SPBuiltInContentTypeId.Document)
                                                       .RemoveOldLinks()
                                                       .AddFieldLink(dateOpenedField).SetRequired(true).Commit()
                                                       .AddFieldLink(amountField).Commit();

            // Create the Invoice content type.
            ArtDevContentType invoiceCType = Feature.CreateContentType("Invoice", financialDocumentCType.type.Id)
                                             .RemoveOldLinks()
                                             .GetFieldLink(SPBuiltInFieldId.Title).SetDisplayName("Service").SetRequired(true).Commit()
                                             .AddFieldLink(clientField).SetRequired(true).Commit()
                                             .SetDocumentTemplate("/ArtDevTemplates/Invoice.docx").Commit();

            // Create the Purchase Order content type.
            ArtDevContentType purchaseOrderCType = Feature.CreateContentType("Purchase Order", financialDocumentCType.type.Id)
                                                   .RemoveOldLinks()
                                                   .GetFieldLink(SPBuiltInFieldId.Title).SetDisplayName("Item").SetRequired(true).Commit()
                                                   .AddFieldLink(costCenterField).SetDisplayName("Department").SetRequired(true).Commit()
                                                   .SetDocumentTemplate("/ArtDevTemplates/PurchaseOrder.docx").Commit();

            ArtDevContentType CTypeOrder = Feature.CreateContentType("Orders", SPBuiltInContentTypeId.Item)
                                           .RemoveOldLinks()
                                           .GetFieldLink(SPBuiltInFieldId.Title).SetDisplayName("ФИО Клиента").SetRequired(true).Commit()
                                           .AddFieldLink(clientField).SetRequired(true).Commit()
                                           .AddFieldLink(dateOpenedField).SetRequired(true).Commit()
                                           .AddFieldLink(amountField).SetRequired(false).Commit()
                                           .AddFieldLink(EmployeeField).SetRequired(true).Commit()
                                           .AddFieldLink(costCenterField).SetRequired(true).Commit()
                                           //  .AddFieldLink(ActiveSiteField).SetRequired(true).Commit()
            ;



            /* CREATE SITE LISTS BY CONTENT TYPE */
            ArtDevList DocumentList = Feature.CreateDocumentLibrary("ArtDevDocument")
                                      .SetListTitle("ArtDev Документы")
                                      .RemoveStandartContentType()
                                      .addContentType(invoiceCType);


            ArtDevList OrderList = Feature.CreateList("Orders")
                                   .SetListTitle("ArtDev Заказы")
                                   .RemoveStandartContentType()
                                   .addContentType(CTypeOrder)
                                   .GetFieldLink(SPBuiltInFieldId.Title).SetFieldTitle("ФИО Клиента").Commit()
                                   .AddFieldLink(ActiveSiteField).SetFieldTitle("Активы сайтов").Commit();


            // Name Template equal Name list
            ArtDevList ArtDevForms = Feature.CreateListTemplate("ArtDevForms")
                                     .SetListTitle("ArtDev Формы")
                                     .RemoveStandartContentType()
                                     .addContentType(CTypeOrder)
                                     .GetFieldLink(SPBuiltInFieldId.Title).SetFieldTitle("ФИО Клиента").Commit();



            ArtDevList ListSetting = Feature.CreateList("ArtDevSettings")
                                     .SetListTitle("ArtDev Настройки")
                                     .GetFieldLink(SPBuiltInFieldId.Title).SetFieldTitle("Параметр").SetFieldRequired(true).Commit()
                                     .AddFieldLink(SettingValueField).SetFieldRequired(true).Commit()
                                     .GetItemByTitle("URL2").SetItem(SettingValueField.field.Id, "http://{url}").Commit()
                                     .GetItem(SettingValueField.field.Id, "http://{url}").SetItem(SPBuiltInFieldId.Title, "URL").Commit()
                                     .AddItemIfNotExsist("URL2", "http://").Commit()
            ;
        }