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

# XblMultiplayerWriteSessionByHandleAsync

> XblMultiplayerWriteSessionByHandleAsync

# XblMultiplayerWriteSessionByHandleAsync

Writes a new or updated multiplayer session to the service, using the specified handle to the session.

## Syntax

```cpp theme={null}
HRESULT XblMultiplayerWriteSessionByHandleAsync(  
         XblContextHandle xblContext,  
         XblMultiplayerSessionHandle multiplayerSession,  
         XblMultiplayerSessionWriteMode writeMode,  
         const char* handleId,  
         XAsyncBlock* async  
)  
```

### Parameters

*xblContext*   \_In\_\
Type: [XblContextHandle](/reference/live/xsapi-c/types_c/handles/xblcontexthandle)

XBOX live context for the local user.

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

A MultiplayerSession object that has been modified with the changes to write.

*writeMode*   \_In\_\
Type: [XblMultiplayerSessionWriteMode](/reference/live/xsapi-c/multiplayer_c/enums/xblmultiplayersessionwritemode)

The type of write operation.

*handleId*   \_In\_\
Type: char\*

The ID of the handle that should be used when writing the session.

*async*   \_In\_\
Type: XAsyncBlock\*

The AsyncBlock for this operation.

### Return value

Type: HRESULT

HRESULT return code for this API operation.

## Remarks

A handle is a service-side pointer to a session. The handle ID is a GUID identifier of the handle. Callers will usually get the handleId either from another player's XblMultiplayerActivityDetails via the XblMultiplayerGetActivitiesForUsersAsync() API, or from an invite. Use this method only if your multiplayer session object doesn't have a valid XblMultiplayerSessionReference, as a handle's lifetime may be shorter than that of the session it points to.

## Requirements

**Header:** multiplayer\_c.h

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

## Conceptual documentation

* [Receiving invites](/services/xbox-services/multiplayer/invites/how-to/live-invites-receive)

## See also

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


## Related topics

- [XblMultiplayerWriteSessionAsync](/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayerwritesessionasync.md)
- [XblMultiplayerSessionWriteMode](/reference/live/xsapi-c/multiplayer_c/enums/xblmultiplayersessionwritemode.md)
- [Multiplayer Session Directory overview](/services/xbox-services/multiplayer/mpsd/live-mpsd-overview.md)
- [Receiving invites](/services/xbox-services/multiplayer/invites/how-to/live-invites-receive.md)
- [Moving from MPSD to PlayFab Multiplayer and MPA](/services/xbox-services/multiplayer/mpsd/concepts/live-mpsd-to-mlp.md)
