defget_dynamic_group_by_email(email):service=build_service()# First we use the email to get the groups name calling lookup()lookup_group_name_request=service.groups().lookup()param="&groupKey.id="+emaillookup_group_name_request.uri+=paramlookup_group_name_response=lookup_group_name_request.execute()name=lookup_group_name_response.get("name")# Then we can call get() by passing in the group's nameresponse=service.groups().get(name=name).execute()returnresponse
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[[["\u003cp\u003eDynamic groups can be retrieved using either their name or email address.\u003c/p\u003e\n"],["\u003cp\u003eTo retrieve a dynamic group by name, use the \u003ccode\u003egroups.get()\u003c/code\u003e method with the group's resource name.\u003c/p\u003e\n"],["\u003cp\u003eRetrieving a dynamic group by email requires using the \u003ccode\u003egroups().lookup()\u003c/code\u003e method initially to get the group name, and subsequently calling \u003ccode\u003egroups.get()\u003c/code\u003e with the name.\u003c/p\u003e\n"],["\u003cp\u003eTo list the memberships of a dynamic group, the \u003ccode\u003egroups.memberships.get()\u003c/code\u003e method is used with the group's resource name, or \u003ccode\u003egroups().memberships().list\u003c/code\u003e in python.\u003c/p\u003e\n"],["\u003cp\u003eDynamic groups are only accessible to premium Cloud Identity accounts.\u003c/p\u003e\n"]]],[],null,["# Retrieving a dynamic group and listing members\n==============================================\n\nYou can retrieve dynamic groups by name or email. After you retrieve a group,\nyou can list its memberships.\n| **Note:** Dynamic groups are only available to Cloud Identity premium accounts.\n\nRetrieving a dynamic group by name\n----------------------------------\n\nThe following sample shows how to retrieve a dynamic group by name: \n\n### REST\n\n\nTo retrieve a dynamic group by name, call\n[`groups.get()`](/identity/docs/reference/rest/v1/groups/get) with the\nresource name of the group.\n\n### Python\n\n\nThe following example shows how to retrieve a dynamic group by name using the\npython library: \n\n def get_dynamic_group_by_name(name):\n service = build_service()\n response = service.groups().get(name=name).execute()\n return response\n\nRetrieving a dynamic group by email\n-----------------------------------\n\nThe following sample shows how to retrieve a dynamic group by email: \n\n### REST\n\n\nTo retrieve a dynamic group by email, call\n[`groups.get()`](/identity/docs/reference/rest/v1/groups/get)\nwith the group email address.\n\n### Python\n\n\nThe following example shows how to retrieve a dynamic group by email using the\npython library: \n\n def get_dynamic_group_by_email(email):\n service = build_service()\n\n # First we use the email to get the groups name calling lookup()\n lookup_group_name_request = service.groups().lookup()\n param = \"&groupKey.id=\" + email\n lookup_group_name_request.uri += param\n lookup_group_name_response = lookup_group_name_request.execute()\n name = lookup_group_name_response.get(\"name\")\n\n # Then we can call get() by passing in the group's name\n response = service.groups().get(name=name).execute()\n return response\n\nListing memberships of a dynamic group\n--------------------------------------\n\nThe following sample shows how to list the memberships of a dynamic group: \n\n### REST\n\n\nTo list memberships of a group, call\n[`groups.memberships.get()`](/identity/docs/reference/rest/v1/groups.memberships/get)\nwith the resource name of the group.\n\n### Python\n\nThe following example shows how to list memberships of a dynamic group using\nthe python library: \n\n def get_dynamic_group_memberships(name):\n service = build_service()\n\n members_request = service.groups().memberships().list(parent=name)\n members_request.uri += \"&view=FULL\"\n response = members_request.execute()\n return response"]]