Programmatically Żid Utent li SharePoint Grupp

Li tassenja lill-utent biex grupp MOSS 2007

Il-kodiċi li ġejjin se jżid l-utent għall-sit u għall-grupp speċifiku.

adduser privati ​​null(sekwenza strSite,sekwenza webGroup)
{
SPSecurity.RunWithElevatedPrivileges(jiddelega()
{
bl-użu (Sit SPSite = ġdid SPSite(strSite))
{
bl-użu (SPWeb web = site.OpenWeb())
{
Boolean allowUnsafeUpdate = l web.AllowUnsafeUpdates;
jippruvaw
{
web.AllowUnsafeUpdates = vera;

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

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

Leave a Reply

Tista 'tuża dawn it-tags HTML

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