= group_members()
:description: Returns the members of a group as a list of ECMUser objects (mng.GetGroupMembers). Includes login names, GUIDs, and display data for all group members.
:keywords: group_members, mng.GetGroupMembers, ECMUser, login, GUID, group members
:page-tags: api, security

Returns all users that are members of the given group.

== Signature

[tabs]
====
Sync::
+
[source,python]
----
ecm.security.group_members(group_name: str) -> list[ECMUser]
----

Async::
+
[source,python]
----
await ecm.security.group_members(group_name: str) -> list[ECMUser]
----
====

== Parameters

[cols="1,1,3"]
|===
|Parameter |Default |Description

|`group_name`
|—
|Name of the group whose members should be returned.
|===

== Return value

List of `ECMUser` instances. Empty list when the group has no members or does not exist.

For `ECMUser` fields — see xref:api/security/users.adoc[users()].

== Examples

=== List members of a group

[tabs]
====
Sync::
+
[source,python]
----
members = ecm.security.group_members("Administrators")
for user in members:
    print(user.username, user.display_name)
----

Async::
+
[source,python]
----
members = await ecm.security.group_members("Administrators")
for user in members:
    print(user.username, user.display_name)
----
====

=== Print all groups with their members

[tabs]
====
Sync::
+
[source,python]
----
for group in ecm.security.groups():
    members = ecm.security.group_members(group.name)
    print(f"{group.name}: {[m.username for m in members]}")
----

Async::
+
[source,python]
----
for group in await ecm.security.groups():
    members = await ecm.security.group_members(group.name)
    print(f"{group.name}: {[m.username for m in members]}")
----
====

== See also

* xref:api/security/groups.adoc[groups()] — Retrieve all groups
* xref:api/security/group.adoc[group()] — Attributes of a single group
* xref:api/security/user_groups.adoc[user_groups()] — Groups of a specific user
