is there a way to get all parent content types of a given content type?
Example:
var docType = Services.ContentTypeService.GetContentType(id);
With the code above I get the content type of the specific content type id. But how I can get all parents of this? I have the requirement to get all properties of a specific content node. But if a content type has parents I only get the properties of the specific content type:
foreach (var prop in Services.ContentTypeService.GetContentType(id).PropertyTypes.OrderBy(p => p.Name))
Is there a simple way to get the PropertyTypes recursive?
Normally you would get all properties including the one from master documenttypes if I am correct. Otherwise you can try to figure out which master doctype is set and get the properties from that.
no, I get only the properties from the current documenttype. But I get the id of the parent document type with this and can use this to get the properties of the master document type:
var docType = Services.ContentTypeService.GetContentType(id).ParentId;
It would however go even easier.
But thank you for bringing me in the right direction.
Was going to post a thread asking for the same... No answers ? Not possible to get a content type parent type's properties? (Well, I was looking for a way do access "description", which I just learned that it is not really a content type property, so no questions from my side anymore)
Get parent content types with ContentTypeService?
Hi all,
is there a way to get all parent content types of a given content type?
Example:
With the code above I get the content type of the specific content type id. But how I can get all parents of this? I have the requirement to get all properties of a specific content node. But if a content type has parents I only get the properties of the specific content type:
Is there a simple way to get the PropertyTypes recursive?
Thanks in advance.
Best,
Sören
Hi Soren,
Do you mean the properties of the parent item in the document tree ?
Or do you mean getting properties of the master document type ?
Dave
Hi Dave,
the last one: getting properties of the master document type.
Best,
Sören
Hi Soren,
Normally you would get all properties including the one from master documenttypes if I am correct. Otherwise you can try to figure out which master doctype is set and get the properties from that.
Dave
Hi Dave,
no, I get only the properties from the current documenttype. But I get the id of the parent document type with this and can use this to get the properties of the master document type:
It would however go even easier.
But thank you for bringing me in the right direction.
Best,
Sören
Was going to post a thread asking for the same... No answers ? Not possible to get a content type parent type's properties? (Well, I was looking for a way do access "description", which I just learned that it is not really a content type property, so no questions from my side anymore)
is working on a reply...