JG Vimalan's Blog

It is all about coding!

Reading values from a column of type Person or Group in MOSS 2007

Suppose you have a custom list or document library with a column named
‘Members’ of type Person or Group with multiple selections then, the
SPFieldUserValueCollection can be used to hold the multiple values.

The following code snippet will give you an idea on accessing
values from a column of type Person or Group.

SPFieldUserValueCollection selectedMembers = (SPFieldUserValueCollection)                                                                             _SpListItemRecord[“Members”];

if (selectedMembers != null)
   {
      string selected= string.Empty;

      foreach (SPFieldUserValue fuv in selectedMembers)
      {
         SPUser userA = web.AllUsers[fuv.LookupValue];
         selected += userA.Name + “,”;
      }     
    }

Regards,

JG Vimalan

Advertisements

September 27, 2009 - Posted by | SharePoint

No comments yet.

Leave a Reply

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

%d bloggers like this: