my scenario : i tried the GetGroupByName method but didnt work,it cant find the group, i am not able to find the id of the group also.

 GroupCollection groupColl = clientContext.Web.SiteGroups;
                Group newgroup = clientContext.Web.SiteGroups.GetByName("InternalUsers");
  • can you please share the code that you have tried ? Sep 14 '17 at 11:40
  • @GautamSheth i edited the question Sep 14 '17 at 11:42
  • I think you need to change it to clientContext.Load(newgroup);. Also ensure that you are passing the correct group name. Sep 14 '17 at 11:46
  • @GautamSheth didnt work,note that this group was created on azure,am being told it a domain group Sep 14 '17 at 12:02
  • its needs to be a sharepoint group. Sep 14 '17 at 12:56

Try this code below :

GroupCollection groupColl = clientContext.Web.SiteGroups;
Group newgroup = groupColl.GetByName("InternalUsers");
  • didnt work, i am being told the group is a domain group Sep 14 '17 at 12:01
  • The above code actually works for SharePoint Groups. Domain groups are treated differently and you'd have to crack open your domain group using Active Directory APIs. Per the error message, the Group name you used is NOT a SharePoint group, but an AD group. As such, SharePoint cannot return anything because even if it had the AD group object, it would be a type mismatch when returned since GetByName() is expected to return a SharePoint Group. Sep 25 '18 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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