I'm writing a Partial View Macro that lists out data from all pages of a specific document type. I've got the pages back okay but would like to get access to the document type that shapes those pages so that I can write out the names of the properties associated with it. All I've found so far makes reference to the DocumentType service e.g. DocumentType.GetByAlias but I don't see anything in the v7 documentation that makes reference to the DocumentType service. Is there a new way of doing this and if not then what namespace do I need to include to get access to the DocumentType service?
Thanks Alessandro, that's exactly what I was looking for. I've now been able to get to the Property Names within a specific Tab by querying:
var contentTypeService = ApplicationContext.Current.Services.ContentTypeService;
var contentType = contentTypeService.GetContentType(myNode.DocumentTypeId);
var propertyList = contentType.CompositionPropertyGroups.ToList()[3].PropertyTypes.ToList();
Umbraco 7 - Get Page Document Type
Hi,
I'm writing a Partial View Macro that lists out data from all pages of a specific document type. I've got the pages back okay but would like to get access to the document type that shapes those pages so that I can write out the names of the properties associated with it. All I've found so far makes reference to the DocumentType service e.g. DocumentType.GetByAlias but I don't see anything in the v7 documentation that makes reference to the DocumentType service. Is there a new way of doing this and if not then what namespace do I need to include to get access to the DocumentType service?
Thanks.
I think you can use DocumentTypeAlias e.g.
Or something like that.
I think that just returns the name (string) of the Document Type and not the actual Document Type itself which is what I'm after.
Thanks though.
Take a look at https://our.umbraco.org/documentation/reference/management/services/contenttypeservice
Hey Craig
See what you mean. You can get the properties for sure, you can do it via a few methods, will come back to you with an example.
Thanks
Thanks Alessandro, that's exactly what I was looking for. I've now been able to get to the Property Names within a specific Tab by querying:
Awesome!
Spot on!
is working on a reply...