Check current user exists in a group using an AJAX call

$.ajax({
    url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups/getByName('Site Members')/Users?         $filter=Id eq " + _spPageContextInfo.userId,
    type: "GET",
    cache: true,
    async: false,
    headers:{
        "ACCEPT": "application/json;odata=verbose"
    },
    success: function (data) {
        if (data.d.results[0] != undefined) {
        //user is a member
        }
    },
    error: function () {
    }
});

Comments

  1. Attractive section of content. I just stumbled upon your site and in accession capital to assert that I get in fact enjoyed account your blog posts.
    sharepoint administrator training

    ReplyDelete
    Replies
    1. Good to see your comments. If any queries related to SharePoint, just send a message i will try give you the solution. Thanks

      Delete

Post a Comment

Popular posts from this blog

IRM and the Object Model

This content database has a schema version which is not supported in this farm

Activate and Deactivate Feature through PowerShell