I have four sub-organizations defined. (/AdminOrg, /subOrgA, /SubOrgB, /subOrgA/SubOrgAA)
my directory.orgunits.list query return below data. I store the return array in a variable called orgUnits[]:
I have 4 users in my organization. one in each sub-organization. the users.list return below data:
I am trying to get no. of users within an organization (without including sub organizations in them)
Option 1: The query directory.users.list.query("orgUnitPath=/subOrgA") includes users from sub organization (/subOrgA/SubOrgAA) too and does not meet my needs.
Option 2: I tried the query directory.users.list.query("orgName=orgUnits[]->name"). It queries for users[]->organizations[]->name. And this field is null by default. It does not get populated with orgUnits[]->name.
My questions are
How to populate users.organizations[].name?
Is there any way I can get users within an organization without including sub-organizations in them
Unfortunately it isn't possible to search for users within an orgUnit not including sub-orgs. The
orginations
field in the Users resource, as well as theorgName
,orgTitle
,orgDepartment
,orgDescription
,orgCostCenter
query parameters, refer to a completely separate set of data that appears to be used by the API only. Only theorgUnitPath
field and query parameter operate on the organizations visible within the Google Apps Admin Console.