protected override void MapProperties(object modelHost, ListItem item, ContentPageDefinitionBase definition) { base.MapProperties(modelHost, item, definition); var typedDefinition = definition.WithAssertAndCast <ItemControlTemplateDefinitionBase>("model", value => value.RequireNotNull()); if (typedDefinition.TargetControlTypes.Count > 0) { item["TargetControlType"] = typedDefinition.TargetControlTypes.ToArray(); } if (!string.IsNullOrEmpty(typedDefinition.PreviewURL)) { var htmlPreviewValue = new FieldUrlValue { Url = typedDefinition.PreviewURL }; if (!string.IsNullOrEmpty(typedDefinition.PreviewDescription)) { htmlPreviewValue.Description = typedDefinition.PreviewDescription; } item["HtmlDesignPreviewUrl"] = htmlPreviewValue; } }
protected override void MapProperties(object modelHost, Hashtable fileProperties, ContentPageDefinitionBase definition) { base.MapProperties(modelHost, fileProperties, definition); var typedTemplateModel = definition.WithAssertAndCast <ItemControlTemplateDefinitionBase>("model", value => value.RequireNotNull()); if (typedTemplateModel.TargetControlTypes.Count > 0) { var multiChoiceValue = new SPFieldMultiChoiceValue(); foreach (var value in typedTemplateModel.TargetControlTypes) { multiChoiceValue.Add(value); } fileProperties["TargetControlType"] = multiChoiceValue.ToString(); } if (!string.IsNullOrEmpty(typedTemplateModel.PreviewURL)) { var htmlPreviewValue = new SPFieldUrlValue { Url = typedTemplateModel.PreviewURL }; if (!string.IsNullOrEmpty(typedTemplateModel.PreviewDescription)) { htmlPreviewValue.Description = typedTemplateModel.PreviewDescription; } fileProperties["HtmlDesignPreviewUrl"] = htmlPreviewValue.ToString(); } }
protected override void MapProperties(object modelHost, ListItem item, ContentPageDefinitionBase definition) { base.MapProperties(modelHost, item, definition); var typedDefinition = definition.WithAssertAndCast <FilterDisplayTemplateDefinition>("model", value => value.RequireNotNull()); item[BuiltInInternalFieldNames.ContentTypeId] = "0x0101002039C03B61C64EC4A04F5361F38510660400F643FF79F6BD764F8A469B6F153396EE"; if (!string.IsNullOrEmpty(typedDefinition.CrawlerXSLFileURL)) { var crawlerXSLFileValue = new FieldUrlValue { Url = typedDefinition.CrawlerXSLFileURL }; if (!string.IsNullOrEmpty(typedDefinition.CrawlerXSLFileDescription)) { crawlerXSLFileValue.Description = typedDefinition.CrawlerXSLFileDescription; } item["CrawlerXSLFile"] = crawlerXSLFileValue; } if (!string.IsNullOrEmpty(typedDefinition.CompatibleManagedProperties)) { item["CompatibleManagedProperties"] = typedDefinition.CompatibleManagedProperties; } if (typedDefinition.CompatibleSearchDataTypes.Count > 0) { item["CompatibleSearchDataTypes"] = typedDefinition.CompatibleSearchDataTypes.ToArray(); } }
protected override void MapProperties(object modelHost, ListItem item, ContentPageDefinitionBase definition) { var typedDefinition = definition.WithAssertAndCast <TemplateDefinitionBase>("model", value => value.RequireNotNull()); item["TemplateHidden"] = typedDefinition.HiddenTemplate; if (!string.IsNullOrEmpty(typedDefinition.Description)) { item["MasterPageDescription"] = typedDefinition.Description; } }
protected override void MapProperties(object modelHost, ListItem item, ContentPageDefinitionBase definition) { var typedDefinition = definition.WithAssertAndCast <MasterPagePreviewDefinition>("model", value => value.RequireNotNull()); item[BuiltInInternalFieldNames.ContentTypeId] = BuiltInContentTypeId.MasterPagePreview; if (typedDefinition.UIVersion.Count > 0) { item["UIVersion"] = string.Join(";#", typedDefinition.UIVersion.ToArray()); } }
protected override void MapProperties(object modelHost, Hashtable fileProperties, ContentPageDefinitionBase definition) { var typedTemplateModel = definition.WithAssertAndCast <TemplateDefinitionBase>("model", value => value.RequireNotNull()); //fileProperties["TemplateHidden"] = typedTemplateModel.HiddenTemplate.ToString(); fileProperties["TemplateHidden"] = typedTemplateModel.HiddenTemplate.ToString(); if (!string.IsNullOrEmpty(typedTemplateModel.Description)) { fileProperties["MasterPageDescription"] = typedTemplateModel.Description; } }
protected override void MapProperties(object modelHost, ListItem item, ContentPageDefinitionBase definition) { base.MapProperties(modelHost, item, definition); var typedDefinition = definition.WithAssertAndCast <ItemDisplayTemplateDefinition>("model", value => value.RequireNotNull()); item[BuiltInInternalFieldNames.ContentTypeId] = "0x0101002039C03B61C64EC4A04F5361F38510660300500DA5E"; //item["DisplayTemplateLevel"] = "Item"; if (!string.IsNullOrEmpty(typedDefinition.ManagedPropertyMappings)) { item["ManagedPropertyMapping"] = typedDefinition.ManagedPropertyMappings; } }
protected override void MapProperties(object modelHost, Hashtable fileProperties, ContentPageDefinitionBase definition) { var typedTemplateModel = definition.WithAssertAndCast <TemplateDefinitionBase>("model", value => value.RequireNotNull()); // SSOM provision for display templates sometimes gives invalid type case error #440 // HiddenTemplate.ToString() happens to fails on some SharePoint's environentns // 1:0 works well // https://github.com/SubPointSolutions/spmeta2/issues/440 fileProperties["TemplateHidden"] = typedTemplateModel.HiddenTemplate ? 1 : 0; if (!string.IsNullOrEmpty(typedTemplateModel.Description)) { fileProperties["MasterPageDescription"] = typedTemplateModel.Description; } }
protected override void MapProperties(object modelHost, ListItem item, ContentPageDefinitionBase definition) { var typedDefinition = definition.WithAssertAndCast <WebPartGalleryFileDefinition>("model", value => value.RequireNotNull()); if (!string.IsNullOrEmpty(typedDefinition.Group)) { item["Group"] = typedDefinition.Group; } if (!string.IsNullOrEmpty(typedDefinition.Description)) { item["WebPartDescription"] = typedDefinition.Description; } item["QuickAddGroups"] = typedDefinition.RecommendationSettings.ToArray(); }
protected override void MapProperties(object modelHost, System.Collections.Hashtable fileProperties, ContentPageDefinitionBase definition) { var typedTemplateModel = definition.WithAssertAndCast <MasterPagePreviewDefinition>("model", value => value.RequireNotNull()); fileProperties[BuiltInInternalFieldNames.ContentTypeId] = BuiltInContentTypeId.MasterPagePreview; if (typedTemplateModel.UIVersion.Count > 0) { var value = new SPFieldMultiChoiceValue(); foreach (var v in typedTemplateModel.UIVersion) { value.Add(v); } fileProperties["UIVersion"] = value.ToString(); } }
protected override void MapProperties(object modelHost, Hashtable fileProperties, ContentPageDefinitionBase definition) { base.MapProperties(modelHost, fileProperties, definition); var typedDefinition = definition.WithAssertAndCast <JavaScriptDisplayTemplateDefinition>("model", value => value.RequireNotNull()); fileProperties[BuiltInInternalFieldNames.ContentTypeId] = "0x0101002039C03B61C64EC4A04F5361F3851068"; if (!string.IsNullOrEmpty(typedDefinition.Standalone)) { fileProperties["DisplayTemplateJSTemplateType"] = typedDefinition.Standalone; } if (!string.IsNullOrEmpty(typedDefinition.TargetControlType)) { fileProperties["DisplayTemplateJSTargetControlType"] = typedDefinition.TargetControlType; } if (!string.IsNullOrEmpty(typedDefinition.TargetListTemplateId)) { fileProperties["DisplayTemplateJSTargetListTemplate"] = typedDefinition.TargetListTemplateId; } if (!string.IsNullOrEmpty(typedDefinition.TargetScope)) { fileProperties["DisplayTemplateJSTargetScope"] = typedDefinition.TargetScope; } if (!string.IsNullOrEmpty(typedDefinition.IconUrl)) { var iconValue = new SPFieldUrlValue { Url = typedDefinition.IconUrl }; if (!string.IsNullOrEmpty(typedDefinition.IconDescription)) { iconValue.Description = typedDefinition.IconDescription; } fileProperties["DisplayTemplateJSIconUrl"] = iconValue.ToString(); } }
protected override void MapProperties(object modelHost, Hashtable fileProperties, ContentPageDefinitionBase definition) { base.MapProperties(modelHost, fileProperties, definition); var typedDefinition = definition.WithAssertAndCast <FilterDisplayTemplateDefinition>("model", value => value.RequireNotNull()); fileProperties[BuiltInInternalFieldNames.ContentTypeId] = "0x0101002039C03B61C64EC4A04F5361F38510660400F643FF79F6BD764F8A469B6F153396EE"; if (!string.IsNullOrEmpty(typedDefinition.CrawlerXSLFileURL)) { var crawlerXSLFileValue = new SPFieldUrlValue { Url = typedDefinition.CrawlerXSLFileURL }; if (!string.IsNullOrEmpty(typedDefinition.CrawlerXSLFileDescription)) { crawlerXSLFileValue.Description = typedDefinition.CrawlerXSLFileDescription; } fileProperties["CrawlerXSLFile"] = crawlerXSLFileValue.ToString(); } if (!string.IsNullOrEmpty(typedDefinition.CompatibleManagedProperties)) { fileProperties["CompatibleManagedProperties"] = typedDefinition.CompatibleManagedProperties; } if (typedDefinition.CompatibleSearchDataTypes.Count > 0) { var multiChoiceValue = new SPFieldMultiChoiceValue(); foreach (var value in typedDefinition.CompatibleSearchDataTypes) { multiChoiceValue.Add(value); } fileProperties["CompatibleSearchDataTypes"] = multiChoiceValue.ToString(); } }
protected override void MapProperties(object modelHost, Hashtable fileProperties, ContentPageDefinitionBase definition) { base.MapProperties(modelHost, fileProperties, definition); var typedTemplateModel = definition.WithAssertAndCast <ControlDisplayTemplateDefinition>("model", value => value.RequireNotNull()); fileProperties[BuiltInInternalFieldNames.ContentTypeId] = "0x0101002039C03B61C64EC4A04F5361F385106601"; if (!string.IsNullOrEmpty(typedTemplateModel.CrawlerXSLFileURL)) { var crawlerXSLFileValue = new SPFieldUrlValue { Url = typedTemplateModel.CrawlerXSLFileURL }; if (!string.IsNullOrEmpty(typedTemplateModel.CrawlerXSLFileDescription)) { crawlerXSLFileValue.Description = typedTemplateModel.CrawlerXSLFileDescription; } fileProperties["CrawlerXSLFile"] = crawlerXSLFileValue.ToString(); } }
protected override void MapProperties(object modelHost, Hashtable fileProperties, ContentPageDefinitionBase definition) { var typedDefinition = definition.WithAssertAndCast <WebPartGalleryFileDefinition>("model", value => value.RequireNotNull()); if (!string.IsNullOrEmpty(typedDefinition.Group)) { fileProperties["Group"] = typedDefinition.Group; } if (!string.IsNullOrEmpty(typedDefinition.Description)) { fileProperties["WebPartDescription"] = typedDefinition.Description; } var recSettingsValue = new SPFieldMultiChoiceValue(); foreach (var value in typedDefinition.RecommendationSettings) { recSettingsValue.Add(value); } fileProperties["QuickAddGroups"] = recSettingsValue.ToString(); }