ಆರ್ಕೈವ್ಸ್

Programmatically Add User to SharePoint Group

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()
{
ಬಳಸಿ (SPSite site = new SPSite(strSite))
{
ಬಳಸಿ (SPWeb web = site.OpenWeb())
{
Boolean allowUnsafeUpdate = web.AllowUnsafeUpdates;
try
{
web.AllowUnsafeUpdates = true;

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

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

ಒಂದು ಉತ್ತರಿಸಿ ಬಿಡಿ

ನೀವು ಬಳಸಬಹುದು ಈ HTML ಟ್ಯಾಗ್ಗಳನ್ನು

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