Here is my complete code for creating a bidirectional relation type between two content nodes (document to document):
var newRelationTypeAlias = "TestRelation";
var relationService = Services.RelationService;
var relationType = new RelationType(new Guid("C66BA18E-EAF3-4CFF-8A22-41B16D66A972"),
new Guid("C66BA18E-EAF3-4CFF-8A22-41B16D66A972"), newRelationTypeAlias, "TestRelationName")
{
IsBidirectional = true
};
relationService.Save(relationType);
How can I create RelationType with API?
Hello,
how I can create a relationType with API? It seems that the RelationService contains no method for this and I can't find any RelationTypeService?
Cheers, Sören
Comment author was deleted
Hey Soren,
Check out the code for the relation type UI, it seems you can use the RelationService https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Web/umbraco.presentation/umbraco/developer/RelationTypes/NewRelationType.aspx.cs
Hi Tim,
thank you very much! This works great :-) #h5yr!
Here is my complete code for creating a bidirectional relation type between two content nodes (document to document):
Cheers,
Sören
Comment author was deleted
Great, glad you have it working!
is working on a reply...