Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi All,
I am using Umbraco version 8.17.0
I am trying to add a custom property to a member type using the following code:
IMemberType memberType = _memberTypeService.Get("Member"); IDataType textType = _dataTypeService.GetAll().Where(x => x.Name == "Textstring").FirstOrDefault(); PropertyType propType = new PropertyType(textType, "myTestProperty"); propType.Name = "My Test Property"; memberType.AddPropertyType(propType); _memberTypeService.Save(memberType);
All works well and the property gets added to the 'Generic properties' group.
But, If I then delete it from the back office, then click 'Save' I get the error:
Validation: The Alias field is required.
Any ideas what I'm doing wrong?
Thanks in advance.
Mark
Update: If I delete it programmatically, it is removed from the backoffice!
memberType.RemovePropertyType("myTestProperty"); _memberTypeService.Save(memberType);
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Programmatically adding custom property to member type
Hi All,
I am using Umbraco version 8.17.0
I am trying to add a custom property to a member type using the following code:
All works well and the property gets added to the 'Generic properties' group.
But, If I then delete it from the back office, then click 'Save' I get the error:
Validation: The Alias field is required.
Any ideas what I'm doing wrong?
Thanks in advance.
Mark
Update: If I delete it programmatically, it is removed from the backoffice!
is working on a reply...