Pemrograman Tambahkan Pengguna ke SharePoint Grup

To assign the user to group in MOSS 2007

The following code will add the user to site and to specified group.

private void AddUser(string strSite,string webGroup)
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
menggunakan (SPSite site = new SPSite(strSite))
{
menggunakan (SPWeb web = site.OpenWeb())
{
Boolean allowUnsafeUpdate = web.AllowUnsafeUpdates;
mencoba
{
web.AllowUnsafeUpdates = true;

web.SiteUsers.Add(loginName, MailId, loginId, “”);
web.Groups[webGroup].AddUser(loginName, MailId, loginId, “”);

}
finally
{
web.AllowUnsafeUpdates = allowUnsafeUpdate;
}
}
}
});
}

Tinggalkan Balasan

Anda dapat menggunakan tag HTML ini

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>