Hi @Tong Zhang_MSFT ,
No, This is not resolving our issue, we are not getting AD groups. It is only providing SP groups
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
We are looking for REST API to get user's all direct and indirect group.
Ex: REST API is only returning groups for which user is directly listed as a member. If user is a member of a site group(Marketing group), indirectly through membership in a nested active directory group then REST API does not return top level group (in this case Marketing group).
Rest API is providing only direct group, we are looking for REST API to get all direct and indirect group for a user.
Hi @Tong Zhang_MSFT ,
No, This is not resolving our issue, we are not getting AD groups. It is only providing SP groups
Hi @Pankaj Kumar ,
According to my research and testing, please try to use the following code to get all groups:
function GetAllSiteGroups() {
$.ajax
({
// _spPageContextInfo.webAbsoluteUrl - will give absolute URL of the site where you are running the code.
// You can replace this with other site URL where you want to apply the function
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups",
type: "GET",
headers:
{
// Accept header: Specifies the format for response data from the server.
"Accept": "application/json;odata=verbose"
},
success: function (data, status, xhr) {
var dataresults = data.d.results;
for (var i = 0; i < dataresults.length; i++) {
console.log("Group Title - " + dataresults[i]["Title"]);
}
},
error: function (xhr, status, error) {
console.log("Failed");
}
});
}
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.