本文介绍了目录api - 使用orgName获取用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我定义了四个子组织。 (/ AdminOrg,/ subOrgA,/ SubOrgB,/ subOrgA / SubOrgAA)

我的directory.orgunits.list查询返回下面的数据。我将返回数组存储在名为orgUnits []的变量中:
$ b



我的组织中有4个用户。每个子组织中有一个。 users.list返回以下数据:





我正在尝试取消。 (不包括其中的子组织)

选项1:
查询directory.users.list.query( orgUnitPath = / subOrgA)也包括来自子组织(/ subOrgA / SubOrgAA)的用户,并且不符合我的需求。



选项2:
我试过了查询directory.users.list.query(orgName = orgUnits [] - > name)。它查询用户[] - >组织[] - >名称。此字段默认为空。它不会被orgUnits [] - >名称填充。



我的问题是


  1. 如何填充users.organizations []。name?


  2. 组织在其中



解决方案

遗憾的是无法搜索用户在orgUnit中不包括子组织。 Users资源中的 orginations 字段以及 orgName orgTitle orgDepartment orgDescription
orgCostCenter 查询参数,指的是仅由API使用的完全独立的一组数据。只有 orgUnitPath 字段和查询参数在Google Apps管理控制台中可见的组织上运行。


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[]:

http://pastebin.com/Kzud6SAq

I have 4 users in my organization. one in each sub-organization. the users.list return below data:

http://pastebin.com/6ttSgDSe

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

  1. How to populate users.organizations[].name?

  2. 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 the orgName, orgTitle, orgDepartment, orgDescription,orgCostCenter query parameters, refer to a completely separate set of data that appears to be used by the API only. Only the orgUnitPath field and query parameter operate on the organizations visible within the Google Apps Admin Console.

这篇关于目录api - 使用orgName获取用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 18:32
查看更多