I am using Umbraco 4.7.2, and would like to retrieve all the Document Types which are beneath a specific document type.
My setup is e.g. like this:
- Base Content Doc Type
- Article Doc Type
- News Item Doc Type
I have tried to retrieve the Base Content Document Type like this: DocumentType.GetByAlias("baseContent"), but it seems like there is no children attached, even though this is visible in the Umbraco Backoffice (There property HasChildren is true, but doc.Children is empty).
Another solution would be to retrieve all document types which parent is the Base Content Document Type, but if I retrieve the Article Doc Type it says that there are no parents (parentID is -1).
Am I doing this the wrong way, or might this be a bug?
Possible bug: Can't get document type children
Hi,
I am using Umbraco 4.7.2, and would like to retrieve all the Document Types which are beneath a specific document type.
My setup is e.g. like this:
- Base Content Doc Type
- Article Doc Type
- News Item Doc Type
I have tried to retrieve the Base Content Document Type like this: DocumentType.GetByAlias("baseContent"), but it seems like there is no children attached, even though this is visible in the Umbraco Backoffice (There property HasChildren is true, but doc.Children is empty).
Another solution would be to retrieve all document types which parent is the Base Content Document Type, but if I retrieve the Article Doc Type it says that there are no parents (parentID is -1).
Am I doing this the wrong way, or might this be a bug?
Try:
DocumentType.GetAllAsList().Where(d=>d.MasterContentType == DocumentType.GetByAlias("baseContent").Id
is working on a reply...