views:

43

answers:

1

how do I get the field content type (i.e. ImageFieldContent, etc.) from an SPListItem?

A: 

Hi,

To get the content type of an item try oItem["ContentType"].tosString() (where oItem is your SPListItem object)

To get the type of the columns within an SPListsItem then you will have to loop through the oItem.Fields and get the FieldvalueType. eg

foreach (SPField oField in oItem.Fields)
        {
         Console.WriteLine(oField.FieldValueType);
        }

Note: FieldValueType: Gets the value type of the field when the field type has its own value type. For a full reference look here http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfield_members.aspx

Renzo