Programmatically ntxiv neeg SharePoint Group

Mus cob rau tus neeg siv mus rau cov pab pawg hauv NTXHUAB 2007

Cov cai nram qab no yuav ntxiv rau cov neeg kawm ntawv thiab cov pab pawg neeg kev cai tswjhwm.

lwm yam khoob lug AddUser(txoj hlua strSite,txoj hlua webGroup)
{
SPSecurity.RunWithElevatedPrivileges(nog()
{
siv (SPSite qhov chaw = tshiab SPSite(strSite))
{
siv (SPWeb web = kawm ntawv.OpenWeb())
{
Boolean allowUnsafeUpdate = Web site.AllowUnsafeUpdates;
sim
{
Web site.AllowUnsafeUpdates = tseeb;

Web site.SiteUsers.Add(loginName, MailId, loginId, “”);
Web site.Tej pawg[webGroup].AddUser(loginName, MailId, loginId, “”);

}
Thaum kawg
{
Web site.AllowUnsafeUpdates = allowUnsafeUpdate;
}
}
}
});
}

sau ntawv cia

Koj siv tau qhov cim npe no HTML

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