> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ListUsers

> IXtfUserClient::ListUsers

# IXtfUserClient::ListUsers

傳回目前與此主機相關聯之所有使用者的清單。

## 語法

```cpp theme={null}
public:
HRESULT ListUsers(
         XTF_USER_DATA **ppUserData,
         UINT32 *pCount
)  
```

### 參數

*ppUserData*\
類型：XTF\_USER\_DATA \*\*

成功傳回時，指向描述目前與主機相關聯之使用者的 [XTF\_USER\_DATA](/zh-TW/reference/tools/xtf/xtfuser/structures/XTF_USER_DATA-xtfuser-xbox-windows-t.md) 物件陣列。

*pCount*\
類型：UINT32 \*

成功傳回時，*ppUserData* 陣列中的元素計數。

### 傳回值

類型：HRESULT

HRESULT 成功或錯誤碼。

## 備註

您的呼叫端程式碼負責使用 `CoTaskMemFree` 釋放與 *ppUserData* 相關聯的記憶體。

如果使用者是受贊助的 (來賓) 使用者，[XTF\_USER\_DATA](/zh-TW/reference/tools/xtf/xtfuser/structures/XTF_USER_DATA-xtfuser-xbox-windows-t.md) 物件中的 `szEmailAddress` 值會是空字串，而 `szGamertag` 則衍生自贊助使用者的玩家代號。

如果使用者從未在此主機上登入，`szGamertag` 會是空字串。

若要將使用者新增至此主機，請使用 [AddUser](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/adduser-ixtfuserclient-xtfuser-xbox-windows-m.md)。若要新增來賓使用者，請使用 [AddSponsoredUser](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/addsponsoreduser-ixtfuserclient-xtfuser-xbox-windows-m.md)。

## 需求

**標頭：** xtfuser.h

**程式庫：** xtfuser.lib

**支援的平台：** Windows (適用於 XBOX 主機工具)

## 另請參閱

[IXtfUserClient 介面](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/ixtfuserclient-xtfuser-xbox-windows-t)


## Related topics

- [XTF_USER_DATA](/zh-TW/reference/tools/xtf/xtfuser/structures/XTF_USER_DATA-xtfuser-xbox-windows-t.md)
- [PairControllerWithUser](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/paircontrollerwithuser-ixtfuserclient-xtfuser-xbox-windows-m.md)
- [PairControllerWithUserId](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/paircontrollerwithuserid-ixtfuserclient-xtfuser-xbox-windows-m.md)
- [ListUsersEx](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/ixtfuserclient_listusersex.md)
- [XblSocialManagerCreateSocialUserGroupFromList](/zh-TW/reference/live/xsapi-c/social_manager_c/functions/xblsocialmanagercreatesocialusergroupfromlist.md)
