To check if a user is part of a group programmatically, we can use this end point: $.ajax({ type: "GET", url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups/getbyname('groupName')/users?$filter=Id eq " + userId, headers: {"accept": "application/json; odata=verbose"}, success: function(data){ // Success logic }, error: function(error){ alert("Error"); console.log(error); } }); When you execute this code, and (if) you get the below error Access denied. You do not have permission to perform this action or access this resource 401 System.UnauthorizedAccessException Navigate to the group, go to Group settings, and ensure "Who can view the membership of the group?" to "Everyone". By default, only the Group Owner can view the membership ...
SharePoint | SharePoint Online | Angular | jQuery | REST | JSOM | Power Automate | Flow | Power Apps