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

# XblMultiplayerSessionGetRoleByName

> XblMultiplayerSessionGetRoleByName

# XblMultiplayerSessionGetRoleByName

ロールの種類名とロール名で XblMultiplayerRole オブジェクトを取得します。

## 構文

```cpp theme={null}
HRESULT XblMultiplayerSessionGetRoleByName(  
         XblMultiplayerSessionHandle handle,  
         const char* roleTypeName,  
         const char* roleName,  
         const XblMultiplayerRole** role  
)  
```

### パラメーター

*handle*   \_In\_\
型: [XblMultiplayerSessionHandle](/reference/live/xsapi-c/multiplayer_c/handles/xblmultiplayersessionhandle)

マルチプレイヤー セッションへのハンドル。

*roleTypeName*   \_In\_z\_\
型: char\*

ロールが属するロールの種類の名前。

*roleName*   \_In\_z\_\
型: char\*

ロールの名前。

*role*   \_Out\_\
型: [XblMultiplayerRole\*\*](/reference/live/xsapi-c/multiplayer_c/structs/xblmultiplayerrole)

ロールに関する情報を持つロール オブジェクトへのポインターを返します。ポインターのメモリは、XblMultiplayerSessionHandle オブジェクトが閉じられるまで、そのライフタイム中は有効です。該当するロールが存在しない場合は、nullptr が返されます。

### 戻り値

型: HRESULT

この API 操作の HRESULT 戻りコード。

## 解説

新しく作成されたセッションでは、XblMultiplayerWriteSessionAsync が呼び出されるまで、ロール情報は設定されないことに注意してください。

## 要件

**ヘッダー:** multiplayer\_c.h

**ライブラリ:** Microsoft.Xbox.Services.14x.GDK.C.lib

## 関連項目

[multiplayer\_c](/reference/live/xsapi-c/multiplayer_c/multiplayer_c_members)
