Skip to main content

XUserGetLocalId

Retrieves a unique game session id for a user.

Syntax

Parameters

user   _In_
Type: XUserHandle
A handle to the user to retrieve the local ID for. userLocalId   _Out_
Type: XUserLocalId*
Contains a unique game session id for a user.

Return value

Type: HRESULT HRESULT success or error code.
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. The XUserLocalId uniquely identifies a user within a gaming session. If you duplicate XUserHandle, both handles maintain the same XUserLocalId. Once the gaming session ends, the same user could have a different XUserLocalId during the next session. Do not use these IDs to track users across gaming sessions. The following example demonstrates how to use the XUserLocalId to retrieve the default audio endpoint for a user.

Requirements

Header: XUser.h Library: xgameruntime.lib Supported platforms: Windows, Steam Deck, XBOX One family consoles and XBOX Series consoles

See also

XUser XUserGetId XUserGetState XUserGetAgeGroup
Last modified on August 20, 2026