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

取得特定使用者的使用者識別碼。

## 語法

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

### 參數

*user*   \_In\_\
類型：XUserHandle

要擷取其使用者識別碼之使用者的控制代碼。

*userId*   \_Out\_\
類型：uint64\_t\*

包含特定使用者的使用者識別碼。

### 傳回值

類型：HRESULT

HRESULT 成功或錯誤碼。

| 傳回碼 | 描述 |
| - | - |
| S\_OK | 作業成功。 |
| E\_GAMEUSER\_RESOLVE\_USER\_ISSUE\_REQUIRED | 使用者必須使用 UI 來解決問題。請呼叫 [XUserResolveIssueWithUiAsync](/zh-TW/reference/system/xuser/functions/xuserresolveissuewithuiasync) 向使用者顯示 UI。 |

## 備註

擷取使用者的 XUID。如果函式傳回 **E\_GAMEUSER\_RESOLVE\_USER\_ISSUE\_REQUIRED**，使用者必須先使用系統 UI 解決問題，函式才能擷取該屬性。請呼叫 [XUserResolveIssueWithUiAsync](/zh-TW/reference/system/xuser/functions/xuserresolveissuewithuiasync) 以顯示系統 UI 並解決問題。

## 需求

**標頭：** XUser.h

**程式庫：** xgameruntime.lib

**支援的平台：** Windows、Steam Deck、XBOX One 系列主機和 XBOX Series 主機

## 概念文件

* [使用 Game Chat 2 C++ API](/zh-TW/services/xbox-services/multiplayer/chat/game-chat2/using-game-chat-2)

## 另請參閱

[XUser](/zh-TW/reference/system/xuser/xuser_members)

[XUserFindUserById](/zh-TW/reference/system/xuser/functions/xuserfinduserbyid)

[XUserFindUserByLocalId](/zh-TW/reference/system/xuser/functions/xuserfinduserbylocalid)


## Related topics

- [XUserGetId](/reference/system/xuser/functions/xusergetid.md)
- [XUserGetLocalId](/reference/system/xuser/functions/xusergetlocalid.md)
