Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Issue with adding People picker control values to UserValueCollection field of a list in Sharepoint 2013

$
0
0

Hi All,

I am getting an issue while adding custom People picker control values to a user multi field in sharepoint2013. I implemented the code as below, which is working fine in development environment but not in Production. 

And different users are adding to list instead of entered users in people picker control in production environment.

Any help would be appreciated.

SPFieldUserValueCollection Usercollection = new SPFieldUserValueCollection();

SPUser spUserAdmin;
 SPFieldUserValue uservalue;

 for (int counter = 0; counter < CW.ResolvedEntities.Count; counter++)
                            {

                                PickerEntity pickerAdmin = (PickerEntity)CW.ResolvedEntities[counter];
                                spUserAdmin = web.EnsureUser(pickerAdmin.Key);
                                uservalue = new SPFieldUserValue(web, spUserAdmin.ID, spUserAdmin.LoginName);
                                Usercollection.Add(uservalue);
                            }

NewItem["UserMultiField"] = Usercollection;

Thanks in advance!


dinesh


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>