XUserGetGamertag
Retrieves the gamertag for a specific user.
Syntax
HRESULT XUserGetGamertag(
XUserHandle user,
XUserGamertagComponent gamertagComponent,
size_t gamertagSize,
char* gamertag,
size_t* gamertagUsed
)
Parameters
user _In_
Type: XUserHandle
A handle to the user to retrieve the gamertag for.
gamertagComponent _In_
Type: XUserGamertagComponent
Type of gamertag to retrieve.
gamertagSize _In_
Type: size_t
Size in bytes of the buffer in the gamertag parameter.
gamertag _Out_writes_bytes_to_(gamertagSize,gamertagUsed)
Type: char
Contains the gamertag for a specific user.
gamertagUsed _Out_opt_
Type: size_t*
Contains the amount of the buffer for holding the gamertag.
Return value
Type: HRESULT
HRESULT success or error code.
Return Code | Description |
---|---|
S_OK | The operation succeeded. |
E_GAMEUSER_RESOLVE_USER_ISSUE_REQUIRED | The user must use a UI to resolve the issue. Call XUserResolveIssueWithUiAsync to display the UI to the user. |
E_INSUFFICIENT_BUFFER | The size of the buffer indicated by gamertagSize is not large enough to hold the requested component. |
E_INVALIDARG | Invalid gamertagComponent provided. |
For a list of error codes, see Error Codes.
Remarks
To retrieve the user ID for a specific user, call XUserGetId.
To retrieve the state of a specific user, call XUserGetState.
To retrieve the age group for a specific user, call XUserGetAgeGroup.
Requirements
Header: XUser.h
Library: xgameruntime.lib
Supported platforms: Windows, Xbox One family consoles and Xbox Series consoles