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

# XblMultiplayerWriteSessionAsync

> XblMultiplayerWriteSessionAsync

# XblMultiplayerWriteSessionAsync

Writes a new or updated multiplayer session to the service. The session must have a valid session reference. If it was not created with one, use XblMultiplayerWriteSessionByHandleAsync instead.

## Syntax

```cpp theme={null}
HRESULT XblMultiplayerWriteSessionAsync(  
         XblContextHandle xblContext,  
         XblMultiplayerSessionHandle multiplayerSession,  
         XblMultiplayerSessionWriteMode writeMode,  
         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.

*async*   \_Inout\_\
Type: XAsyncBlock\*

The AsyncBlock for this operation.

### Return value

Type: HRESULT

HRESULT return code for this API operation.

## Remarks

In the async callback, call XblMultiplayerWriteSessionResult() to get a XblMultiplayerSessionHandle handle. Use that handle to call XblMultiplayerSessionWriteStatus() to get the write status. The call to XblMultiplayerWriteSessionAsync() will only fail if the args passed to it are invalid or in very rare cases where it could not start the async task.

## REST Call

Calls V105 PUT /serviceconfigs/{serviceConfigurationId}/sessionTemplates/{sessiontemplateName}/sessions/{sessionName}

## Requirements

**Header:** multiplayer\_c.h

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

## See also

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


## Related topics

- [XblMultiplayerSessionWriteMode](/reference/live/xsapi-c/multiplayer_c/enums/xblmultiplayersessionwritemode.md)
- [XblMultiplayerSessionWriteStatus](/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayersessionwritestatus.md)
- [XblMultiplayerWriteSessionResult](/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayerwritesessionresult.md)
- [XblMultiplayerSessionCreateHandle](/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayersessioncreatehandle.md)
- [XblMultiplayerWriteSessionByHandleResult](/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayerwritesessionbyhandleresult.md)
