V6 Using the new IContentType and add Property to PropertyGroup
Hi
I try to add properties to a PropertyGroup, the tab is created but the properties that i added to them is not showing in the correct tab thay all go to Generic Properties tab and if i look into the database at cmsPropertyType then propertyTypeGroupId is NULL for every properties that i added ?
foreach (PropertyGroup propertyGroup in contentType.PropertyGroups.Where(x => x.Name == propertyTab.Name))
{
bool found = false;
foreach (var type in propertyGroup.PropertyTypes)
{
if(type.Alias == propertyType.Alias)
{
found = true;
}
}
if(!found)
{
propertyGroup.PropertyTypes.Add(propertyType);
}
}
Im using the following namespaces:
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
using Umbraco.Core.Models.PropertyType;
V6 Using the new IContentType and add Property to PropertyGroup
Hi
I try to add properties to a PropertyGroup, the tab is created but the properties that i added to them is not showing in the correct tab thay all go to Generic Properties tab and if i look into the database at cmsPropertyType then propertyTypeGroupId is NULL for every properties that i added ?
Im using the following namespaces:
Hi Robert,
First check if your desired group exists. After that use as follow:
if(desiredGroup == null) {
contentTypeItem.AddPropertyGroup(desiredGroup.Name);
}
contentTypeItem.MovePropertyType(propertyType.Alias, desiredGroup.Name);
is working on a reply...