robrtc
robrtc

Reputation: 2727

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?

Upvotes: 6

Views: 283

Answers (1)

Ram G
Ram G

Reputation: 4829

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;
}

Upvotes: 8

Related Questions