MOSS 2007 - Add users to current group



Add users to SharePoint Group

private void AddSPUsers()
{
using (SPSite site = new SPSite("http://syntaxhelpintranetportal.com"))
{
  using (SPWeb web = site.OpenWeb())
  {
    string login = "forms:UserName";
    string groupName = "Group";
    SPUser user = web.EnsureUser(login);
    SPGroup group = web.Groups[];
    group.AddUser(user);
  }
}
}

Share |

 Cant find the page you are looking for?
 Help us to improve by adding the content that you are looking for.
 Leave a feedback
 We look forward to hear your comments and feedback.