How to retrieve and update the People and Group Field in Sharepoint using c#

This code will help to understand, how to get People and Group value and use it for different purpose.           

 using (SPSite site = new SPSite("http://URL"))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    SPList list = web.Lists["Shared Documents"];
                    SPListItemCollection itemCollection = list.Items;
                    foreach (SPListItem item in itemCollection)
                    {
                        SPFieldUserValue val = new SPFieldUserValue(web, item["Modified By"].ToString());
                    }
                }
            }
           

Advertisements

One thought on “How to retrieve and update the People and Group Field in Sharepoint using c#

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 )

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