Search This Blog

Sunday, March 26, 2017

Add Users to Sharepoint Group in SharePoint 2013 using CSOM

 using(ClientContext clientContext = new ClientContext("http://Test.sharepoint.com/sites/TestSite/"))
 {
            GroupCollection Groups = context.Web.SiteGroups;
            //Get the group by its name 
            Group ownersGroup = Groups.GetByName("GroupName");
            // Create the new user info  
            UserCreationInformation userCreationInfo = new UserCreationInformation();
            userCreationInfo.Email = "Parthasarathy@sharepoint.com";
            userCreationInfo.LoginName = "sharepoint\\Parthasarathy";
            userCreationInfo.Title = "User";  
            // Add the user to the group  
            User newUser = ownersGroup.Users.Add(userCreationInfo);
            context.ExecuteQuery();
 }  

1 comment:

  1. Hi,

    is there any way to access security category in project server 2016, need to add user to security category via CSOM

    ReplyDelete