This is my code.
var oupath = '/';
listObject = {
customer: 'my_customer',
query: "isSuspended=false",
query: "orgUnitPath=" + oupath,
maxResults: 100
}
As stated on G Suite Admin SDK ressources site, 'orgUnitPath=/' returns all users in the organization
I need my query to search the users only within the root OU, excluding members of all child OU. Is this possible ?
There isn't a way to filter or exclude child organizations from the Users.list method when using the query term "orgUnitPath". And as you correctly mention, it returns all of the users from the root OU and all child OUs. You have to filter the results to get only the users from the OU that matches your filter.