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

# XblMultiplayerManagerJoinGameFromLobby

> XblMultiplayerManagerJoinGameFromLobby

# XblMultiplayerManagerJoinGameFromLobby

Creates a new game session for the lobby session, or joins an existing game session if one exists for the lobby session.

## Syntax

```cpp theme={null}
HRESULT XblMultiplayerManagerJoinGameFromLobby(  
         const char* sessionTemplateName  
)  
```

### Parameters

*sessionTemplateName*   \_In\_z\_\
Type: char\*

The name of the session template for the game session to be based on.

### Return value

Type: HRESULT

HRESULT return code for this API operation.

## Remarks

This function creates a new game session and adds the current members of the lobby session to the game session, if a game session doesn't already exist. If a new user joins the lobby session after a game session is already created, this function finds the existing game session in Multiplayer Session Directory (MPSD) by using a transfer handle in the lobby session, and then adds the new user to the game session using that transfer handle. For more information, see [Multiplayer concepts overview](/services/xbox-services/multiplayer/concepts/live-multiplayer-concepts). If a lobby session doesn't exist, likely because [XblMultiplayerManagerInitialize](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagerinitialize) wasn't called before calling this function, an error occurs. An error also occurs if matchmaking is in progress. This function does not migrate existing lobby session properties to the game session. <br />The result of this function is delivered as a multiplayer event with an event type set to `XblMultiplayerEventType::JoinGameCompleted`. You can call [XblMultiplayerManagerDoWork](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagerdowork) to retrieve multiplayer events.  <br />When attempting to join a lobby session, the service returns `HTTP_E_STATUS_BAD_REQUEST` if the server is full.  <br />After joining, you can set the properties for the game session by calling [XblMultiplayerManagerGameSessionSetProperties](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagergamesessionsetproperties) or [XblMultiplayerManagerGameSessionSetSynchronizedProperties](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagergamesessionsetsynchronizedproperties), or you can set the host for the game session by calling [XblMultiplayerManagerGameSessionSetSynchronizedHost](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagergamesessionsetsynchronizedhost).

## Requirements

**Header:** multiplayer\_manager\_c.h

**Library:** Microsoft.Xbox.Services.14x.GDK.C.lib

## See also

[multiplayer\_manager\_c](/reference/live/xsapi-c/multiplayer_manager_c/multiplayer_manager_c_members)\
[XblMultiplayerManagerJoinability](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagerjoinability)\
[XblMultiplayerManagerJoinGame](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagerjoingame)\
[XblMultiplayerManagerJoinLobby](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagerjoinlobby)


## Related topics

- [XblMultiplayerManagerJoinLobby](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagerjoinlobby.md)
- [XblMultiplayerManagerLobbySessionAddLocalUser](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagerlobbysessionaddlocaluser.md)
- [Play multiplayer with friends using Multiplayer Manager](/services/xbox-services/multiplayer/mpm/how-to/live-play-multiplayer-with-friends.md)
- [XblMultiplayerManagerLeaveGame](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagerleavegame.md)
- [XblMultiplayerManagerLobbySessionRemoveLocalUser](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagerlobbysessionremovelocaluser.md)
