Tuesday 12 June 2012

How to populate people group field in sharepoint list -- server object model

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Data;
using System.IO;


namespace peoplegroup
{


    public partial class peoplegroupUserControl : UserControl
    {


       protected void btnSubmit_Click(object sender, EventArgs e)
        {


             string owneraccounts = pplpicker.CommaSeparatedAccounts;


             char[] split = { ',' };

            SPSite site = SPContext.Current.Site;
            SPWeb web = site.RootWeb;
            SPList ownerList = web.Lists["ownerdetails"];
            SPListItem ownerListItem = ownerList.Items.Add();
            ownerListItem["owner"] = PersonIncharge();
            
            web.AllowUnsafeUpdates = false;
            ownerListItem.Update();
            web.AllowUnsafeUpdates = true;




         }


}
}

No comments:

Post a Comment