【问题标题】:How to get Custom Attributes in Google Admin SDK API?如何在 Google Admin SDK API 中获取自定义属性?
【发布时间】:2021-08-25 16:07:35
【问题描述】:

我们目前在 Google 管理员中为我们公司拥有的所有 Chromebook 设备提供了自定义字段。我目前正在寻找从 Google Admin SDK API 获取我们的自定义字段。我已经研究了所有 Google's documentation,但没有看到任何引用自定义字段的内容。

谁能给我提供这方面的文件?

【问题讨论】:

    标签: google-admin-sdk


    【解决方案1】:

    希望这会有所帮助——我也在为同样的事情苦苦挣扎。 “预测/看涨期权”是您所需要的:

    // Projection and associated type/method implements CallOption
    // interface to enable seeing custom user attributes.
    //
    // https://developers.google.com/admin-sdk/directory/reference/rest/v1/users/get#Projection
    // https://github.com/googleapis/google-api-go-client/blob/v0.14.0/googleapi/googleapi.go#L378
    func Projection(p string) googleapi.CallOption {
            return projection(p)
    }
    
    // ...
    func whatever() {
      // lists user with custom attributes
      u, _ := client.Users.Get(email).Do(Projection("FULL"))
      fmt.Printf("DEBUG: %+v", string(u.CustomSchemas["attribute_name"]))
    }
    

    【讨论】:

      猜你喜欢
      • 2019-01-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-20
      • 1970-01-01
      相关资源
      最近更新 更多