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