[英]How to get Tridion FieldType in Tridion 2011?
Is it possible to get the Field Type in Tridion 2011 TOM.NET? 是否有可能在Tridion 2011 TOM.NET中获得字段类型?
The ItemField class has a name and definition, but I don't see the old trusted ItemType property. ItemField类有一个名称和定义,但我没有看到旧的可信ItemType属性。
I have a feeling I need to use the Definition property, but not sure what is the cleanest way. 我有一种感觉我需要使用Definition属性,但不确定什么是最干净的方法。
Any ideas? 有任何想法吗?
You could use the following way to check the field type: 您可以使用以下方法检查字段类型:
itemField is EmbeddedSchemaField
itemField is KeywordField
and Itemfield GetType also provides the same information as well. 和Itemfield GetType也提供相同的信息。
switch (itemField.GetType().Name)
{
case "EmbeddedSchemaField":
fieldType = "EmbeddedSchema";
break;
case "DateField":
fieldType = "Date Field";
break;
case "MultiLineTextField":
fieldType = "RTF Text";
break;
default:
break;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.