To get the value for Person or Group Column Type after removing the special characters from it, use this function
private string GetValue(SPListItem item, SPField gpField)
{
string currentValue = item[gpField.Title].ToString();
SPFieldLookup field = (SPFieldLookup)gpField;
SPFieldLookupValue fieldValue = (SPFieldLookupValue)field.GetFieldValue(currentValue);
return fieldValue.LookupValue;
}
to call it
string strName = GetValue(spListItem, spListItem.Fields["fieldName"]);
Bye..
Discover more from Nishant Rana's Weblog
Subscribe to get the latest posts sent to your email.

Sure SPFieldLookup ? Not SPFieldUserValue?
LikeLike
works for both .SPFieldlookUp for a lookUp ,,SpFieldUser for People or Group
LikeLike
and what If I need to get the account id / username from active directory using that Look up column value.
Thanks
Amit Mathur
LikeLike
Thanks Buddy !
LikeLike