1

I have a SPListItem, with different fields (string, lookup, etc), that I have to iterate them and do different actions depending of the type.

How can I detect if value is type String or type Lookup?

  value = spListItem["nameField"];  // is string or lookup?
1

You can simply use the C# is operation. Ie.

if (value is SPFieldLookupValue) {}
| improve this answer | |
0

try this

string tipoCampo = itemCollection.Fields[ColumnsAssignation.ComboText].TypeAsString;
if (tipoCampo == "Lookup") {}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.