SharePoint User column and multiple values


Okay this is in a way update to my previous post about SharePoint lookup column.  This code example works well when you have column that is set to contain multiple user values.


(PeopleEditor pe; declared in the proper place and proper way)

ArrayList userLogins = pe.ResolvedEntities;

SPFieldUserValueCollection usersCollection = new SPFieldUserValueCollection();

foreach(PickerEntity userLogin in userLogins)


SPFieldUserValue valueToAdd = new SPFieldUserValue(SPContext.Current.Web, int.Parse(userLogin.EntityData[“SPUserID”].ToString()), userLogin.EntityData[“DisplayName”].ToString());



//now we have a proper usersCollection with accounts that were given and validated in PeopleEditor

//and all what there is left is to save information as the SharePoint way which means userID;#DisplayName#;userID;# … which is quite painful if you try to make it only as a string modification

splistItem[“ColumnNameThatIsMultiUserColumn”] = usersCollection.ToString();



Voilá a whole less painfull. I do not know if there is a way to get that SPFieldUserValueCollection directly from PeopleEditor, but for quick searching it seemed that things are not that simple. Feel free to comment if there is something more into this. And if needed I can create sample of adding these multiuservalues to PeopleEditor (which after creating this is more like walk in the park).


About Sakarih

I am SharePoint developer/architect from Finland and my blogposts are all about SharePoint 2007/2010/2013 stuff. There might be also something else posted.
This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to SharePoint User column and multiple values

  1. Unknown says:

    thank you so much for this post it really helped me!!

  2. My brother recommended I may like this website. He was entirely
    right. This publish actually made my day.
    You can not imagine just how a lot time I had spent for this info!
    Thank you!

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s