Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Tridion FieldType in Tridion 2011?

Is it possible to get the Field Type in Tridion 2011 TOM.NET?

The ItemField class has a name and definition, but I don't see the old trusted ItemType property.

I have a feeling I need to use the Definition property, but not sure what is the cleanest way.

Any ideas?

like image 485
robrtc Avatar asked Nov 06 '12 16:11

robrtc


1 Answers

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.

switch (itemField.GetType().Name)
{
case "EmbeddedSchemaField":
   fieldType = "EmbeddedSchema";
   break;
case "DateField":
   fieldType = "Date Field";
   break;
case "MultiLineTextField":
   fieldType = "RTF Text";
   break;
default:
    break;
}
like image 184
Ram G Avatar answered Oct 20 '22 06:10

Ram G