//[SampleMetadataTag(Name = BuiltInTagNames.SampleHidden)] public void CanDeploySimpleListFieldLinkDefinition() { var fieldDef = new TextFieldDefinition { Title = "Customer number", InternalName = "m2CustomNumber", Id = new Guid("87247c7d-1ecc-4503-bfd5-21f107b442fb") }; var listDef = new ListDefinition { Title = "Customers", TemplateType = BuiltInListTemplateTypeId.GenericList, CustomUrl = "lists/customers", }; var siteModel = SPMeta2Model.NewSiteModel(site => { site.AddTextField(fieldDef); }); var webModel = SPMeta2Model.NewWebModel(web => { web.AddList(listDef, list => { // will add a link to the site level field list.AddListFieldLink(fieldDef); }); }); DeployModel(siteModel); DeployModel(webModel); }
protected override FieldDefinition GetFieldDefinitionTemplate() { var def = new TextFieldDefinition { MaxLength = Rnd.Int(32) + 1 }; def.ValidationMessage = string.Format("validatin_msg_{0}", Rnd.String()); def.ValidationFormula = string.Format("=[ID] * {0}", Rnd.Int(100)); return(def); }
//[SampleMetadataTag(Name = BuiltInTagNames.SampleHidden)] public void CanRemoveContentTypeFieldLink() { var customName = new TextFieldDefinition { Title = "Custom Name", InternalName = "m2_CustomName", Group = "SPMeta2.Samples", Id = new Guid("8EE0C5C6-BD47-4111-9707-660B737F9F9B"), }; var customObjectContentType = new ContentTypeDefinition { Name = "M2 Custom Object", Id = new Guid("C6F60CBE-48AE-434D-955C-7A45DC32AD9A"), ParentContentTypeId = BuiltInContentTypeId.Item, Group = "SPMeta2.Samples" }; var model = SPMeta2Model.NewSiteModel(site => { site .AddField(customName) .AddContentType(customObjectContentType, contentType => { contentType .AddContentTypeFieldLink(customName) .AddRemoveContentTypeFieldLinks(new RemoveContentTypeFieldLinksDefinition { Fields = new List <FieldLinkValue> { new FieldLinkValue { Id = BuiltInFieldId.Title } } }); }); }); DeployModel(model); }
public static ModelNode AddTextField(this ModelNode model, TextFieldDefinition definition, Action <ModelNode> action) { return(model.AddDefinitionNode(definition, action)); }
public static ModelNode AddTextField(this ModelNode model, TextFieldDefinition definition) { return(AddTextField(model, definition, null)); }
public static TModelNode AddTextField<TModelNode>(this TModelNode model, TextFieldDefinition definition, Action<TextFieldModelNode> action) where TModelNode : ModelNode, IFieldHostModelNode, new() { return model.AddTypedDefinitionNode(definition, action); }
public static TModelNode AddTextField<TModelNode>(this TModelNode model, TextFieldDefinition definition) where TModelNode : ModelNode, IFieldHostModelNode, new() { return AddTextField(model, definition, null); }