Get Value for Person or Group Column Type

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..


Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

4 thoughts on “Get Value for Person or Group Column Type”

Share your thoughts

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s