【问题标题】:Retrieve all or children organization units using Google Client Library使用 Google 客户端库检索所有或子单位部门
【发布时间】:2014-12-15 06:36:41
【问题描述】:

如何使用谷歌客户端库检索谷歌应用域中的所有组织单位?我们需要使用哪个函数来检索 google 客户端库中的 OrgUnits ?

我在gdata-python-client site 上没有找到任何文档

def create_service():
    f = file(API_DATA["SERVICE_PEM_PATH"], 'rb')
    key = f.read()
    f.close()

    credentials = SignedJwtAssertionCredentials(API_DATA["SERVICE_EMAIL"], key, scope=API_DATA["DIRECTORY_SCOPES"], sub=API_DATA["ADMIN_EMAIL"])
    http = httplib2.Http()
    http = credentials.authorize(http)

    service = build("admin", "directory_v1", http=http)
    return service


directory = create_service()

# directory.RetrieveAllOrganizationUsers() -- Function to retrieve Org Units ?? 

【问题讨论】:

    标签: google-api google-apps google-api-python-client


    【解决方案1】:

    有一个专门用于此的 API 方法:orgunits.list

    The reference documentation is here.

    The Python library documentation is here.

    我不是 python 专家,但我希望调用看起来像这样:

    directory.orgunits().list(customerId='my_customer').execute()
    

    因为这不是 GData API,所以你没有在那里找到信息。 GData 是旧的 API 格式的名称,Google 正在逐步弃用它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-24
      • 1970-01-01
      • 2020-01-04
      相关资源
      最近更新 更多