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;
}
}
}
Aspx Code
<SharePoint:PeopleEditor ID="pplpicker" runat="server" Height="25px"
Width="200px" AutoPostBack="True" BorderStyle="Groove" DialogHeight="200"
DialogWidth="200" MultiSelect="False" Rows="1"
SelectionSet="User,SecGroup,SPGroup" />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" onclick="btnSubmit_Click"/>
string[] splitPeoplePickerData = owneraccounts.Split(split);
SPFieldUserValueCollection pplgrpcoll = new SPFieldUserValueCollection();
for (int i = 0; i < splitPeoplePickerData.Length; i++)
string[] splitPPData = Accounts.Split(splitter);
{
string SelectedAccount = splitPeoplePickerData[i];
if (SelectedAccount != string.))
{
SPUser user = web.SiteUsers[SelAccount];
SPFieldUserValue pplgrpfld = new SPFieldUserValue(web, user.ID, user.LoginName);
pplgrpcoll.Add(pplgrpfld);
}
}
No comments:
Post a Comment