I am creating subsite through powershell script csom. Subsite is getting created but not sharepoint groups under subsite. what could be the reason?Please respond

2 Answers 2


You probably need to break the role inheritence for the subsite. This post describes how to do this using CSOM: https://www.morgantechspace.com/2016/04/break-permission-inheritance-in-sharepoint-csom.html


If select unique permission, then it needs to also write csom code to create the group, it will not create group automatically:

 class Program  

     private class Configuration  
                public static string ServiceSiteUrl = "https:// https://gowthamr.sharepoint.com";  
                public static string ServiceUserName = "[email protected]";  
                public static string ServicePassword = "xxxxxxxxxx";  

          static ClientContext GetonlineContext()  
        var securePassword = new SecureString();  
        foreach (char c in Configuration.ServicePassword)  
    var onlineCredentials = new SharePointOnlineCredentials(Configuration.ServiceUserName, securePassword);  
    var context = new ClientContext(Configuration.ServiceSiteUrl);  
    context.Credentials = onlineCredentials;  
    return context;  

        static void Main(string[] args)  
            var ClientContext=GetonlineContext();  
            Web web = clientContext.Web;             
            GroupCreationInformation groupCreationInfo = new GroupCreationInformation();  
            groupCreationInfo.Title = "Gowtham_Group";  
            groupCreationInfo.Description="Custom Group Created...";  
            User owner = web.EnsureUser(@"XXXXXX");  
            User member = web.EnsureUser(@"YYYYYY");   
            Group group = web.SiteGroups.Add(groupCreationInfo);  
            group.Owner = owner;  

Reference: Create Group In SharePoint 2013 Online Using CSOM

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.