2016-04-26 55 views
1

我試圖一把umbraco獲得可用標籤(7.4.2):獲取一把umbraco卡口與C#

DocumentType dt = new DocumentType(1051); //id of documenttype 
foreach (ContentType.Tab x in dt.getVirtualTabs) 
{ 
    ... 
} 

但是...... DocumentType是過時的,當我試圖打電話給getVirtualTabs後來我例外,我不能使用它。

如何獲得可用標籤?

回答

2

看看這裏:https://our.umbraco.org/Documentation/Reference/Management/Models/ContentType - 部分原因是由於新的組成可能看起來像很多在這方面已經改變了:-)

它應該是那麼容易,因爲

var contentType = contentTypeService.GetContentType(1051); 

foreach (PropertyGroup pg in contentType.PropertyGroups) 
{ 
    ... 
} 

編輯

對於ContentTypeService看看這裏:https://our.umbraco.org/documentation/Reference/Management/Services/ContentTypeService

+0

謝謝你。 – liammcdee