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

# XUserFindUserByLocalId

> XUserFindUserByLocalId

# XUserFindUserByLocalId

Retrieves a handle to the user for a specific local user ID.

## Syntax

```cpp theme={null}
HRESULT XUserFindUserByLocalId(  
         XUserLocalId userLocalId,  
         XUserHandle* handle  
)  
```

### Parameters

*userLocalId*   \_In\_\
Type: [XUserLocalId](/reference/system/xuser/structs/xuserlocalid)

The local ID to get the user for.

*handle*   \_Out\_\
Type: XUserHandle\*

Contains a handle to the user associated with a specific local user ID.

### Return value

<Note>This function isn't safe to call on a time-sensitive thread. For more information, see [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

Type: HRESULT

HRESULT success or error code.

| Return Code                             | Description              |
| --------------------------------------- | ------------------------ |
| S\_OK                                   | The operation succeeded. |
| HRESULT\_FROM\_WIN32(ERROR\_NOT\_FOUND) | The user was not found.  |

## Remarks

For each **XUserHandle** handle that you retrieve from an **XUser** API, inluding **XUserFindUserByLocalId**, you must
close that handle calling [XUserCloseHandle](/reference/system/xuser/functions/xuserclosehandle). The reference count of the handle increases after calling Get / Find functions.

To retrieve a handle to a user for a specific local user ID, call XUserFindUserByLocalId.

To retrieve the XBOX User ID (XUID) for a local user, call [XUserFindUserById](/reference/system/xuser/functions/xuserfinduserbyid).

To retrieve a user ID for a specific device ID, call [XUserFindForDevice](/reference/system/xuser/functions/xuserfindfordevice).

## Requirements

**Header:** XUser.h

**Library:** xgameruntime.lib

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

## Conceptual documentation

* [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## See also

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

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

[XUserFindForDevice](/reference/system/xuser/functions/xuserfindfordevice)


## Related topics

- [XUserFindUserById](/reference/system/xuser/functions/xuserfinduserbyid.md)
- [XUserLocalId](/reference/system/xuser/structs/xuserlocalid.md)
- [XUserGetId](/reference/system/xuser/functions/xusergetid.md)
- [XUser](/reference/system/xuser/xuser_members.md)
- [Unity C# API wrappers for the GDK](/build/gdk-and-engines/unity/unity-api-wrappers.md)
