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

# XtfGetCredentialServerName

> XtfGetCredentialServerName

# XtfGetCredentialServerName

Gets the server name part of the credentials stored at an index in an XtfNetworkCredentials object returned by [XtfGetCredentialInfoList](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialinfolist-xtfapi-xbox-windows-m).

<a id="syntaxSection" />

## Syntax

```cpp theme={null}
HRESULT XtfGetCredentialServerName(
         XtfNetworkCredentials credentialInfo,
         UINT32 credentialIndex,
         PWSTR serverName,
         UINT32 *serverNameSize
)  
```

<a id="ID4EK" />

### Parameters

*credentialInfo*<br />Type: XtfNetworkCredentials

\[in] An XtfNetworkCredentials object created by calling [XtfGetCredentialInfoList](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialinfolist-xtfapi-xbox-windows-m).

*credentialIndex*<br />Type: UINT32

\[in] Index of the serverName in the **credentialInfo** object.

*serverName*<br />Type: PWSTR

\[out] Server name at the given index in the **credentialInfo** object.

*serverNameSize*<br />Type: UINT32 \*

\[in, out] Length of serverName buffer in WCHAR.

<a id="ID4ER" />

### Return value

Type: HRESULT

Returns **S\_OK** if successful. Returns `HRESULT_FROM_WIN32(ERROR_MORE_DATA)` if **serverName** is not large enough. The required buffer length is returned in **serverNameLength**.

<a id="remarks" />

## Remarks

Use [XtfAddCredential](/reference/tools/xtf/xtfapi/functions/xtfaddcredential-xtfapi-xbox-windows-m) to add credentials. Use [XtfRemoveCredential](/reference/tools/xtf/xtfapi/functions/xtfremovecredential-xtfapi-xbox-windows-m) to remove credentials. Use [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), and [XtfGetCredentialUserName](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialusername-xtfapi-xbox-windows-m) to enumerate the current list of stored credentials. Use [XtfCloseCredentialInfoList](/reference/tools/xtf/xtfapi/functions/xtfclosecredentialinfo-xtfapi-xbox-windows-m) to free the XtfNetworkCredentials returned by [XtfGetCredentialInfoList](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialinfolist-xtfapi-xbox-windows-m).

See [XtfGetCredentialInfoList](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialinfolist-xtfapi-xbox-windows-m) for an example of how to use this API.

## Requirements

**Header:** xtfapi.h

**Library:** XtfApi.lib

**Supported platforms:** Windows (for XBOX console tools)

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

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