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

# XtfGetCredentialUserName

> XtfGetCredentialUserName

# XtfGetCredentialUserName

[XtfGetCredentialInfoList](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialinfolist-xtfapi-xbox-windows-m) によって返された XtfNetworkCredentials オブジェクトの、あるインデックスに保存されている資格情報のユーザー名部分を取得します。

<a id="syntaxSection" />

## Syntax

```cpp theme={null}
HRESULT XtfGetCredentialUserName(
         XtfNetworkCredentials credentialInfo,
         UINT32 credentialIndex,
         PWSTR userName,
         UINT32 *userNameLength
)  
```

<a id="ID4EK" />

### Parameters

*credentialInfo*<br />型: XtfNetworkCredentials

\[in] [XtfGetCredentialInfoList](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialinfolist-xtfapi-xbox-windows-m) を呼び出して作成された XtfNetworkCredentials オブジェクトです。

*credentialIndex*<br />型: UINT32

\[in] **credentialInfo** オブジェクト内の **userName** のインデックスです。

*userName*<br />型: PWSTR

\[out] **credentialInfo** オブジェクト内の指定されたインデックスにあるユーザー名です。

*userNameLength*<br />型: UINT32 \*

\[in, out] **userName** バッファーの長さ (WCHAR 単位) です。

<a id="ID4ER" />

### Return value

型: HRESULT

成功した場合は **S\_OK** を返します。**userName** の長さが足りない場合は HRESULT\_FROM\_WIN32(ERROR\_MORE\_DATA) を返します。必要なバッファーの長さは **userNameLength** に返されます。

<a id="remarks" />

## Remarks

資格情報を追加するには [XtfAddCredential](/reference/tools/xtf/xtfapi/functions/xtfaddcredential-xtfapi-xbox-windows-m) を使用します。資格情報を削除するには [XtfRemoveCredential](/reference/tools/xtf/xtfapi/functions/xtfremovecredential-xtfapi-xbox-windows-m) を使用します。現在保存されている資格情報の一覧を列挙するには、[XtfGetCredentialInfoList](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialinfolist-xtfapi-xbox-windows-m)、[XtfGetCredentialInfoCount](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialinfocount-xtfapi-xbox-windows-m)、[XtfGetCredentialServerName](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialtargetname-xtfapi-xbox-windows-m)、[XtfGetCredentialUserName](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialusername-xtfapi-xbox-windows-m) を使用します。[XtfGetCredentialInfoList](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialinfolist-xtfapi-xbox-windows-m) から返される XtfNetworkCredentials を解放するには、[XtfCloseCredentialInfoList](/reference/tools/xtf/xtfapi/functions/xtfclosecredentialinfo-xtfapi-xbox-windows-m) を使用します。

この API の使用例については [XtfGetCredentialInfoList](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialinfolist-xtfapi-xbox-windows-m) を参照してください。

## Requirements

**ヘッダー:** xtfapi.h

**ライブラリ:** XtfApi.lib

**サポートされているプラットフォーム:** Windows (XBOX コンソール ツール用)

## See also

[Run from PC Deployment (NDA topic)](/home/setup-install/concepts/deployment)<br />[XTF Transport Errors (NDA topic)](/tools/tools-console/commandlinetools/xtf-transport-errors)<br />[Additional Xtf APIs](/reference/tools/xtf/xtfapi/atoc-xtfapi)


## Related topics

- [XtfGetCredentialServerName](/ja-jp/reference/tools/xtf/xtfapi/functions/xtfgetcredentialtargetname-xtfapi-xbox-windows-m.md)
- [XtfGetCredentialInfoList](/ja-jp/reference/tools/xtf/xtfapi/functions/xtfgetcredentialinfolist-xtfapi-xbox-windows-m.md)
- [XtfAddCredential](/ja-jp/reference/tools/xtf/xtfapi/functions/xtfaddcredential-xtfapi-xbox-windows-m.md)
- [XtfRemoveCredential](/ja-jp/reference/tools/xtf/xtfapi/functions/xtfremovecredential-xtfapi-xbox-windows-m.md)
- [XtfCloseCredentialInfoList](/ja-jp/reference/tools/xtf/xtfapi/functions/xtfclosecredentialinfo-xtfapi-xbox-windows-m.md)
