Thursday, August 16, 2012

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;
            }

No comments:

Post a Comment

Server Error in '/' Application when activating "Nintex Forms" web app feature.

Apparently "INSTALL-NFService" need to be run in SharePoint PowerShell to fix this problem.   When I installed Nintex Forms agai...