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

# PFMultiplayerJoinArrangedLobby

> Join a PlayFab lobby using an arrangement string from matchmaking or another service; the lobby initializes from configuration if no one has joined.

Joins a lobby using an arrangement string provided by another service, such as matchmaking. If no one has joined the lobby yet, the lobby is initialized using the configuration parameters.

## Syntax

```cpp theme={null}
HRESULT PFMultiplayerJoinArrangedLobby(  
    PFMultiplayerHandle handle,  
    const PFEntityKey* newMember,  
    const char* arrangementString,  
    const PFLobbyArrangedJoinConfiguration* configuration,  
    void* asyncContext,  
    PFLobbyHandle* lobby  
)  
```

### Parameters

**`handle`**   PFMultiplayerHandle

The handle of the PFMultiplayer API instance.

**`newMember`**   [PFEntityKey\*](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmultiplayer/pfentitykey_clientsdk)

The local PlayFab entity joining the lobby.

**`arrangementString`**   char\*\
*is null-terminated*

The arrangement string used by the entity to join the lobby.

**`configuration`**   [PFLobbyArrangedJoinConfiguration\*](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyarrangedjoinconfiguration)

The initial configuration data used to initialize the lobby, if no one has joined the lobby yet.

**`asyncContext`**   void\*\
*optional*

An optional, app-defined, pointer-sized context value that can be used to associate the completion state change with this call.

**`lobby`**   PFLobbyHandle\*\
*optional, library-allocated output*

The optional, output lobby object which can be used to queue operations for immediate execution of this operation completes.

### Return value

Type: HRESULT

`S_OK` if the call succeeded or an error code otherwise. The human-readable form of the error code can be retrieved via [PFMultiplayerGetErrorMessage()](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmultiplayer/functions/pfmultiplayergeterrormessage).

## Remarks

This is an asynchronous operation. Upon successful completion, the title will be provided a [PFLobbyMemberAddedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbymemberaddedstatechange) followed by a [PFLobbyJoinArrangedLobbyCompletedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyjoinarrangedlobbycompletedstatechange) with the [PFLobbyJoinArrangedLobbyCompletedStateChange::result](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyjoinarrangedlobbycompletedstatechange) field set to `S_OK`. Upon a failed completion, the title will be provided a [PFLobbyJoinArrangedLobbyCompletedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyjoinarrangedlobbycompletedstatechange) with the [PFLobbyJoinArrangedLobbyCompletedStateChange::result](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyjoinarrangedlobbycompletedstatechange) field set to a failure. <br /><br /> When using matchmaking through this library, the [PFMatchmakingMatchDetails::lobbyArrangementString](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/structs/pfmatchmakingmatchdetails) can be used with this method to join a lobby with all of the users that have been matched together.

## Requirements

**Header:** PFLobby.h

## See also

[PFLobby members](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/pflobby_members)


## Related topics

- [Use lobby and matchmaking together](/services/playfab/multiplayer/lobby/lobby-and-matchmaking.md)
- [Moving from MPSD to PlayFab Multiplayer and MPA](/services/xbox-services/multiplayer/mpsd/concepts/live-mpsd-to-mlp.md)
- [PFMatchmakingMatchDetails](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/structs/pfmatchmakingmatchdetails.md)
- [PFMultiplayer C/C++ API overview - PFLobby.h](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/pflobby_members.md)
- [PFLobbyStateChangeType](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/enums/pflobbystatechangetype.md)
