> ## 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.

# IXtfUserClient::AddSponsoredUser

> IXtfUserClient::AddSponsoredUser

# IXtfUserClient::AddSponsoredUser

新增來賓使用者。

<a id="syntaxSection" />

## 語法

```cpp theme={null}
public:
HRESULT AddSponsoredUser(
         UINT32 *pUserId
)  
```

<a id="parametersSection" />

### 參數

*pUserId*\
類型：UINT32 \*

成功完成時，指向來賓使用者的使用者識別碼。

<a id="retvalSection" />

### 傳回值

類型：HRESULT

HRESULT 成功或錯誤碼。

<a id="remarksSection" />

## 備註

來賓使用者 (也稱為*受贊助的來賓*) 會與已登入的帳戶相關聯。當您的程式碼呼叫此方法時，系統會使用清單中第一個已登入的使用者作為贊助者，並在後續所有受贊助的使用者中持續使用該使用者。如果選取的使用者登出，所有受贊助的使用者也會在此時登出。

<Note>與用來新增受贊助使用者的 UI 不同，此方法在進行選取時無法存取 XBOX Live 隱私權設定和線上安全設定。</Note>

若要新增非來賓使用者，請使用 [AddUser](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/adduser-ixtfuserclient-xtfuser-xbox-windows-m)。

如需來賓使用者的詳細資訊，請參閱[來賓使用者概觀](/zh-TW/build/core-features/common/user/users-guest-overview)。

<a id="requirementsSection" />

## 需求

**標頭：** xtfuser.h

**程式庫：** xtfuser.lib

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

<a id="seealsoSection" />

## 另請參閱

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


## Related topics

- [IXtfUserClient::ListUsers](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/listusers-ixtfuserclient-xtfuser-xbox-windows-m.md)
- [IXtfUserClient::AddUser 方法](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/adduser-ixtfuserclient-xtfuser-xbox-windows-m.md)
- [IXtfUserClient::DeleteUser](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/deleteuser-ixtfuserclient-xtfuser-xbox-windows-m.md)
- [IXtfUserClient::DeleteAllUsers](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/deleteallusers-ixtfuserclient-xtfuser-xbox-windows-m.md)
- [IXtfUserClient::SigninUser](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/signinuser-ixtfuserclient-xtfuser-xbox-windows-m.md)
