创建动态群组成员资格查询

如需在 Google 管理控制台中创建动态群组成员资格查询,您可以使用默认标准属性、您创建的自定义属性,也可以同时使用这两种属性。

本页内容

使用标准属性

在管理控制台中创建动态群组时,您可以从“条件”列表中选择标准属性。 您可以使用下表中的所有属性来创建动态群组成员资格查询。

属性

示例代码

国家/地区

addresses.country

user.addresses.exists(address, address.country == '加拿大')

国家/地区代码

addresses.country_code

user.addresses.exists(address, address.country_code == '555')

自定义地址类型

addresses.custom_type

user.addresses.exists(address, address.custom_type=='自定义地址类型')

扩展地址

addresses.extended_address

user.addresses.exists(address, address.extended_address=='美国加利福尼亚州')

地址(市行政区)

addresses.locality

user.addresses.exists(address, address.locality=='加利福尼亚州南部')

邮政编码

addresses.postal_code

user.addresses.exists(address, address.postal_code=='94040')

邮政信箱

addresses.po_box

user.addresses.exists(address, address.po_box=='87132')

是主要地址

addresses.primary

user.addresses.exists(address, address.primary==true)

地区

addresses.region

user.addresses.exists(address, address.region=='西南')

街道地址

addresses.street_address

user.addresses.exists(address, address.street_address=='Fake 街 123 号')

地址类型

addresses.type

user.addresses.exists(address, address.type==1)

电子邮件地址

emails.address

user.emails.exists(email, email.address.startsWith(''))

自定义邮箱类型

emails.custom_type

email.address.startsWith('custom@google.com')

是主电子邮件地址

emails.primary

user.emails.exists(email, email.primary==true)

电子邮件类型

emails.type

user.emails.exists(email, email.type==1)

自定义外部 ID 类型

external_ids.custom_type

user.external_ids.exists(id, id.custom_type.startsWith('运动员'))

外部 ID 类型

external_ids.type

user.external_ids.exists(id, id.type==3)

外部 ID

external_ids.value

user.external_ids.exists(id, id.value=='')

性别代词

gender.address_me_as

user.gender.address_me_as=='TA'

自定义性别类型

gender.custom_gender

user.gender.custom_gender.startsWith('自定义性别')

适用性别

gender.type

user.gender.type==3

自定义 IMS 协议

ims.custom_protocol

user.ims.exists(im, im.custom_protocol.startsWith('自定义'))

自定义 IMS 类型

ims.custom_type

user.ims.exists(im, im.custom_type.startsWith('自定义'))

标准 IMS 协议

ims.standard_protocol

user.ims.exists(im, im.standard_protocol==7)

是主要 IMS

ims.primary

user.ims.exists(im, im.primary==true)

IMS 类型

ims.type

user.ims.exists(im, im.type==3)

即时通讯软件

ims.value

user.ims.exists(im, im.value=='聊天')

自定义关键字类型

keywords.custom_type

user.keywords.exists(keyword, keyword.custom_type.startsWith('合同工'))

关键字类型

keywords.type

user.keywords.exists(keyword, keyword.type==3)

关键字

keywords.value

user.keywords.exists(keyword, keyword.value=='工程师')

语言代码

languages.language_code

user.languages.exists(language, language.language_code=='英语')

位置区域

locations.area

user.locations.exists(loc, loc.area=='旧金山附近')

建筑物 ID

locations.building_id

user.locations.exists(loc, loc.building_id=='')

自定义位置类型

locations.custom_type

user.locations.exists(loc, loc.custom_type=='地区')

办公桌代码

locations.desk_code

user.locations.exists(loc, loc.desk_code=='37 室')

楼层名称

locations.floor_name

user.locations.exists(loc, loc.floor_name=='')

下限部分

locations.floor_section

user.locations.exists(loc, loc.floor_section=='')

位置类型

locations.type

user.locations.exists(loc, loc.type==1)

Last name(姓氏)

name.family_name

user.name.family_name==''

First name(名字)

name.given_name

user.name.given_name==''

名称

name.value

user.name.value==''

成本中心

organizations.cost_center

user.organizations.exists(org, org.cost_center=='')

自定义组织类型

organizations.custom_type

user.organizations.exists(org, org.custom_type=='公益')

部门

organizations.department

user.organizations.exists(org, org.department=='')

员工类型

organizations.description

user.organizations.exists(org, org.description=='搜索提供商')

网域

organizations.domain

user.organizations.exists(org, org.domain=='example.net')

组织所在地

organizations.location

user.organizations.exists(org, org.location=='加利福尼亚州')

组织名称

organizations.name

user.organizations.exists(org, org.name=='Google')

是主要组织

organizations.primary

user.organizations.exists(org, org.primary==true)

组织符号

organizations.symbol

user.organizations.exists(org, org.symbol=='GOOG')

职位

organizations.title

user.organizations.exists(org, org.title=='')

组织类型

organizations.type

user.organizations.exists(org, org.type==2)

自定义电话类型

phones.custom_type

user.phones.exists(phone, phone.custom_type.startsWith('新类型'))

是主要电话

phones.primary

user.phones.exists(phone, phone.primary==true)

电话类型

phones.type

user.phones.exists(phone, phone.type==11)

电话号码

phones.value

user.phones.exists(phone, phone.value=='')

自定义关系类型

relations.custom_type

user.relations.exists(rel, rel.custom_type=='示例')

关系值

relations.value

user.relations.exists(rel, rel.value=='桑达')

关系类型

relations.type

user.relations.exists(rel, rel.type==12)

自定义网站类型

websites.custom_type

user.websites.exists(site, site.custom_type.startsWith('创意写作'))

是主要网站

websites.primary

user.websites.exists(site, site.primary==true)

网站类型

websites.type

user.websites.exists(site, site.type==2)

网站

websites.value

user.websites.exists(site, site.value=='google.com')

祖级组织部门

org_units.org_unit_id

user.org_units.exists(org_unit, org_unit.org_unit_id==orgUnitId(''))

经理的电子邮件地址

managers.user_id

user.managers.exists(manager, manager.user_id==userId(''))

已归档

已归档

user.archived==true

登录时更改密码

change_password_at_next_login

user.change_password_at_next_login==true

已强制启用两步验证

is_2sv_enforced

user.is_2sv_enforced==true

已注册两步验证

is_enrolled_in_2sv

user.is_enrolled_in_2sv==true

已设置邮箱

is_mailbox_setup

user.is_mailbox_setup==true

主电子邮件

primary_email

user.primary_email==''

已暂停

suspended

user.suspended==true

暂停原因

suspension_reason

user.suspension_reason==4

上级组织部门

org_unit_id

user.org_unit_id==orgUnitId('')

性别

Gender.Gender

user.custom_schemas.Gender.Gender.exists(G, G=='')

种族

Ethnicity.Ethnicity

user.custom_schemas.Ethnicity.Ethnicity.exists(E, E=='')

使用自定义属性

在管理控制台中创建成员资格查询时,自定义属性会显示在“条件”列表中标准属性之后。

如果您运行的查询包含自定义属性,并且查询未返回任何成员,则 Groups API 中可能错误地设置了属性。具体而言,需要将“indexed”属性设置为 true。如需了解详情,请参阅自定义用户属性

自动将用户纳入动态群组

您可以编辑用户的账号信息,使其匹配查询条件,从而自动将用户纳入动态群组中。您可以使用 Directory API 编辑用户的任何账号详细信息。有关详情,请参阅更新用户账号

您还可以在管理控制台中(通常是在“用户”页面中)编辑某些用户账号详细信息,包括:

已启用两步验证 已注册两步验证
地址类型 祖级组织部门
建筑物 ID 登录时更改密码
成本中心 部门
电子邮件地址 电子邮件类型
外部 ID 名字
楼层名称 楼层分区
已封存 是主电子邮件地址
已设置邮箱 已暂停
职位 姓氏
管理员用户 ID 名称
上级组织部门 电话号码
电话类型

从动态群组中排除用户

如需仅添加不满足条件的用户,请为动态群组创建条件,然后点击“排除”图标 。例如,要创建一个仅包含非美国境内用户的群组,您可以创建“国家/地区代码等于 US”这一条件,然后点击“排除”图标 。在查询中,您会看到一个表示排除的感叹号 (!)。

对于某些包含“exists”参数的自定义查询,您无法使用排除选项。有关详情,请参阅编写和测试查询