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

# XUserGetId

> XUserGetId

# XUserGetId

Gets the user ID for a specific user.

## Syntax

```cpp theme={null}
HRESULT XUserGetId(  
         XUserHandle user,  
         uint64_t* userId  
)  
```

### Parameters

*user*   \_In\_\
Type: XUserHandle

A handle to the user to retrieve the user ID for.

*userId*   \_Out\_\
Type: uint64\_t\*

Contains the user ID for a specific user.

### 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](/reference/system/xuser/functions/xuserresolveissuewithuiasync) to display the UI to the user. |

## Remarks

Retrieves the user's XUID. If the function returns **E\_GAMEUSER\_RESOLVE\_USER\_ISSUE\_REQUIRED**, the user needs to use the system UI to resolve the problem before the function can retrieve the property. Call [XUserResolveIssueWithUiAsync](/reference/system/xuser/functions/xuserresolveissuewithuiasync) to display the system UI and resolve the issue.

## Requirements

**Header:** XUser.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, Steam Deck, XBOX One family consoles and XBOX Series consoles

## Conceptual documentation

* [Using the Game Chat 2 C++ API](/services/xbox-services/multiplayer/chat/game-chat2/using-game-chat-2)

## See also

[XUser](/reference/system/xuser/xuser_members)

[XUserFindUserById](/reference/system/xuser/functions/xuserfinduserbyid)

[XUserFindUserByLocalId](/reference/system/xuser/functions/xuserfinduserbylocalid)


## Related topics

- [XUserGetLocalId](/reference/system/xuser/functions/xusergetlocalid.md)
- [User identity and XUser](/build/core-features/common/user/player-identity-xuser.md)
- [XUserGetMaxUsers](/reference/system/xuser/functions/xusergetmaxusers.md)
- [XUserGetGamertag](/reference/system/xuser/functions/xusergetgamertag.md)
- [Using the Game Chat 2 C++ API](/services/xbox-services/multiplayer/chat/game-chat2/using-game-chat-2.md)
