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

# PFMultiplayerClaimServerLobby

> PFMultiplayerClaimServerLobby reference for claiming ownership of an existing server-owned PlayFab lobby as a game_server via the PlayFab Multiplayer C++ SDK.

Claim ownership of a pre-existing server lobby.

## Syntax

```cpp theme={null}
HRESULT PFMultiplayerClaimServerLobby(  
    PFMultiplayerHandle handle,  
    const PFEntityKey* server,  
    const char* lobbyId,  
    void* asyncContext,  
    PFLobbyHandle* lobby  
)  
```

### Parameters

**`handle`**   PFMultiplayerHandle

The handle of the PFMultiplayer API instance.

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

The PlayFab Entity Key of the game server claiming the lobby. It's entity type must be "game\_server".

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

The ID of the Lobby to claim.

**`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

To use this feature, you must define PFMULTIPLAYER\_INCLUDE\_SERVER\_APIS before including PFLobby.h. <br /><br /> This is an asynchronous operation. Upon successful completion, the title will be provided a [PFLobbyClaimServerLobbyCompletedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyclaimserverlobbycompletedstatechange) with the [PFLobbyClaimServerLobbyCompletedStateChange::result](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyclaimserverlobbycompletedstatechange) field set to `S_OK`. Upon a failed completion, the title will be provided a [PFLobbyClaimServerLobbyCompletedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyclaimserverlobbycompletedstatechange) with the [PFLobbyClaimServerLobbyCompletedStateChange::result](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyclaimserverlobbycompletedstatechange) field set to a failure.   <br /><br /> This operation is primarily intended to support game\_server entities taking ownership of server-owned lobbies who's owners have disconnected or will disconnect. Typically, this is interesting for game\_server entities who want to migrate ownership to another game\_server entity or game\_server entities who need to recover ownership of their own servers after some fatal failure which causes them to lose access to the lobby handle such as a crash.   <br /><br /> A game server may not claim ownership of a lobby which another game\_server entity is currently connected to.

## Requirements

**Header:** PFLobby.h

## See also

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


## Related topics

- [PFLobbyGetLobbyProperty](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbygetlobbyproperty.md)
- [PFLobbyGetLobbyPropertyKeys](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbygetlobbypropertykeys.md)
- [PFLobbyGetMembers](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbygetmembers.md)
- [PFLobbyGetSearchProperty](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbygetsearchproperty.md)
- [PFLobbyGetSearchPropertyKeys](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbygetsearchpropertykeys.md)
