> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PartyManager::SetWorkMode

> Configures the work mode of the Party library processing task associated with `threadId`.

Configures the work mode of the Party library processing task associated with `threadId`.

## Syntax

```cpp theme={null}
PartyError SetWorkMode(  
    PartyThreadId threadId,  
    PartyWorkMode workMode  
)  
```

### Parameters

**`threadId`**   [PartyThreadId](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/enums/partythreadid.md)

A high-level categorization of the Party library's internal processing task.

**`workMode`**   [PartyWorkMode](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/enums/partyworkmode.md)

The target work mode for the associated processing task.

### Return value

PartyError

`c_partyErrorSuccess` if the call succeeded or an error code otherwise. The human-readable form of the error code can be retrieved via [GetErrorMessage()](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_geterrormessage.md).

## Remarks

If the work mode is set as [PartyWorkMode::Automatic](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/enums/partyworkmode.md), the processing task associated with `threadId` is handled internally by the Party library. If the work mode is configured as [PartyWorkMode::Manual](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/enums/partyworkmode.md), the title must instead perform the processing task associated with `threadId` via periodic calls to [DoWork()](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_dowork.md). \
\
&#x20;This method can only be called when the Party library is uninitialized. Calling while initialized will fail and return an error.   \
\
&#x20;Configuration of the work mode associated with `threadId` persists across subsequent calls to [Cleanup()](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_cleanup.md) and [Initialize()](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_initialize.md).

## Requirements

**Header:** Party.h

## See also

[PartyManager](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/classes/PartyManager/partymanager.md)\
[PartyManager::GetWorkMode](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_getworkmode.md)\
[PartyManager::DoWork](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_dowork.md)


## Related topics

- [PartyManager::GetWorkMode](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_getworkmode.md)
- [PartyWorkMode](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/enums/partyworkmode.md)
- [PartyManager::DoWork](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_dowork.md)
- [PartyThreadId](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/enums/partythreadid.md)
- [PlayFab Party Release Notes](https://docs.xbox.com/services/playfab/multiplayer/networking/release-notes.md)
