Programatically Binding Values to People Picker


try
            {
                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    SPSite site = SPContext.Current.Site;

                    SPWeb web = site.OpenWeb();
                    web.AllowUnsafeUpdates = true;
                    SPList list = web.Lists["SendDocument"];
                    SPListItem item = list.Items.Add();
                    //string testuser = PeopleTo.CommaSeparatedAccounts.ToString();
                    //SPUser newUser = SPContext.Current.Web.EnsureUser(PeopleTo.CommaSeparatedAccounts.ToString());
                    item["To"] = SPContext.Current.Web.EnsureUser(PeopleTo.CommaSeparatedAccounts.ToString());
                    item["tcc"] = txtBx.Text.ToString();
                    item.Update();
                    web.AllowUnsafeUpdates = false;

                });
            }
            catch (Exception)
            {
               
                throw;
            }

Comments

Popular posts from this blog

IRM and the Object Model

This content database has a schema version which is not supported in this farm

Activate and Deactivate Feature through PowerShell