please help I Cannot Add Multiple users to a SPFieldUserValueCollection without removing the previous one. evertime I add to my collection the previous user gets removed. here is my code below.

spWeb.AllowUnsafeUpdates = true;

SPFieldUserValueCollection usercollection = new SPFieldUserValueCollection(spWeb, LearningCalendar_Item["Course Attendies"].ToString());
usercollection.Add(new SPFieldUserValue(spWeb, SPContext.Current.Web.CurrentUser.ID, SPContext.Current.Web.CurrentUser.Name.ToString()));
LearningCalendar_Item["Course Attendies"] = usercollection;

spWeb.AllowUnsafeUpdates = false;

1 Answer 1


Try the below code:

spWeb.AllowUnsafeUpdates = true;

SPUser user = spWeb.EnsureUser(SPContext.Current.Web.CurrentUser.LoginName);   

SPFieldUserValueCollection values = (SPFieldUserValueCollection)LearningCalendar_Item["Course Attendies"];

values.Add(new SPFieldUserValue(web, user.ID, user.Name));

LearningCalendar_Item["Course Attendies"] = values;


spWeb.AllowUnsafeUpdates = false;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.