Using CSOM Check Current Logged in User is Exist in Particular Some SharePoint Group

  1. public bool IsCurrentUserExistInSPGroup(ClientContext ctx, string groupName)  
  2. {  
  3.     Web web = ctx.Web;  
  4.     ctx.Load(web.CurrentUser.Groups);  
  5.     ctx.ExecuteQuery();  
  6.     GroupCollection groups = web.CurrentUser.Groups;  
  7.     foreach(Group group in groups)  
  8.     {  
  9.         if (group.Title == groupName)  
  10.         {  
  11.             return true;  
  12.         }  
  13.     }  
  14.     return false;  
  15. }