Update SharePoint multiple user field
Sample code:
item["ParticipantsPicker"]=BuildMultiSPUserValue(new string[]{"user1","user2"},web);
public static SPFieldUserValueCollection BuildMultiSPUserValue(string[] userValues,SPWeb web)
{
SPFieldUserValueCollection userCollection = new SPFieldUserValueCollection();
foreach (string item in userValues)
{
SPFieldUserValue userValue = ConvertLoginName(item, web);
userCollection.Add(userValue);
}
return userCollection;
}
private static SPFieldUserValue ConvertLoginName(string userID,SPWeb web)
{
SPUser user = web.EnsureUser(userID);
SPFieldUserValue userValue = new SPFieldUserValue(web, user.ID, user.LoginName);
return userValue;
}