# Access in-meeting user information

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

After you join a meeting, use `meeting::GetMeetingToolkit(...)` to read participant lists,
`meeting::GetParticipantsToolkit(...)` to resolve a user by ID or role, and your
`IZMToolSuiteProxyListener` - set during initialization - for roster changes.

## Join a meeting, leave a meeting, or change status

When users join, leave, or change status in a meeting or webinar, implement `OnUserStatusChanged`
on the same listener object you pass to `ZMToolSuiteProxy::SetToolSuiteProxyListener(...)`.

Inspect `vUserList.eUserAction (ZMToolSuiteUserAction)` and iterate `vUserList.vUserList`.

```cpp
class MyEventListener : public ZMToolSuiteProxy::IZMToolSuiteProxyListener {
public:
    void OnUserStatusChanged(
        ZMToolSuiteProxy::ZMToolSuiteUserList vUserList,
        ZMToolSuiteProxy::ZMToolSuiteMeetingInstance eInstance
    ) override {
        // vUserList.error_code, vUserList.eUserAction
        if (!vUserList.vUserList) return;
        for (int i = 0; i < vUserList.vUserList->GetCount(); ++i) {
            ZMToolSuiteProxy::ZMToolSuiteUser user = vUserList.vUserList->GetItem(i);
            (void)user.iUserID;
            (void)user.strUserName;
        }
    }
    // implement other required listener methods...
};
```

## Get participant information

To get the current participants' information in a meeting, use `GetParticipantsList`.
In a webinar, get this information by using `the `GetAttendeeList`.

```cpp
auto* meetingApi = meeting::GetMeetingToolkit(g_meetingInstance);
IToolSuiteVector<ZMToolSuiteUser>* participants = meetingApi->GetParticipantsList();
for (int i = 0; participants && i < participants->GetCount(); ++i) {
    ZMToolSuiteUser user = participants->GetItem(i);
    (void)user.iUserID;
    (void)user.strUserName;
}
IToolSuiteVector<ZMToolSuiteUser>* attendees = meetingApi->GetAttendeeList(); // webinar-style attendee list when applicable
```

## Look up one user

Get the current user by using `GetMySelf`. If you are looking for another specific user,
pass their `userID` to `GetUserByUserID`.

```cpp
auto* participantsApi = meeting::GetParticipantsToolkit(g_meetingInstance);
ZMToolSuiteUser me = participantsApi->GetMySelf();
ZMToolSuiteUser other = participantsApi->GetUserByUserID(12345);
```

## View the user's meeting or webinar role

Meeting and webinar roles use one of these values under `ZMToolSuiteUserRole`.

-   `ZMToolSuiteUserRole_None`
-   `ZMToolSuiteUserRole_Host`
-   `ZMToolSuiteUserRole_CoHost`
-   `ZMToolSuiteUserRole_Attendee`
-   `ZMToolSuiteUserRole_Panelist`
-   `ZMToolSuiteUserRole_BreakoutRoomModerator`

## Get the user's role in the current meeting or webinar

To check a user's current role, use GetUserRoleByUserID.

```cpp
participantsApi->GetUserRoleByUserID(
    12345,
    [](const GetUserRoleByUserIDResult& result) {
        if (result.error_code == kZMToolSuiteProxyErrorsSuccess) {
            ZMToolSuiteUserRole role = result.role;
            (void)role;
        }
    }
);
```

## Check if a given user is the current user

To check if a user is the current user, use the `bMyself` boolean.

```cpp
bool isMe = participantsApi->GetMySelf().bMyself;
```
