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 () {
}
});
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 () {
}
});
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.
ReplyDeletesharepoint administrator training
Good to see your comments. If any queries related to SharePoint, just send a message i will try give you the solution. Thanks
Delete