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

# XblSocialManagerDoWork

> XblSocialManagerDoWork

Called whenever the title wants to update the social graph and get list of change events.

## Syntax

```cpp theme={null}
HRESULT XblSocialManagerDoWork(  
         const XblSocialManagerEvent** socialEvents,  
         size_t* socialEventsCount  
)  
```

### Parameters

*socialEvents*   \_Outptr\_result\_maybenull\_\
Type: [XblSocialManagerEvent\*\*](https://docs.xbox.com/reference/live/xsapi-c/social_manager_c/structs/xblsocialmanagerevent.md)

Passes back a pointer to the array of social events that have occurred since the last call to XblSocialManagerDoWork. This array is only valid until the next call to XblSocialManagerDoWork. The internal array will automatically be cleaned up when XblCleanupAsync is called.

*socialEventsCount*   \_Out\_\
Type: size\_t\*

Passes back the number of events in the social events array.

### Return value

Type: HRESULT

Returns `S_OK` if successful, including when there are no events. When there are no events, `socialEvents` is set to null and `socialEventsCount` is set to 0. Possible error codes include the following. This list isn't exhaustive.

| Return code | Description |
| - | - |
| E\_INVALIDARG | `socialEvents` or `socialEventsCount` is null. The arguments are validated before the initialization check. |
| E\_XBL\_NOT\_INITIALIZED | The XBOX services API isn't initialized. |

## Remarks

Must be called every frame for data to be up to date. The array of social events that is sent back is only valid until the next call to [XblSocialManagerDoWork](https://docs.xbox.com/reference/live/xsapi-c/social_manager_c/functions/xblsocialmanagerdowork.md). Make sure to check if there were social events sent back. If the social events array is null, no results. If the social events count is 0, no results. If there were social events sent back then handle each [XblSocialManagerEvent](https://docs.xbox.com/reference/live/xsapi-c/social_manager_c/structs/xblsocialmanagerevent.md) by their respective [XblSocialManagerEventType](https://docs.xbox.com/reference/live/xsapi-c/social_manager_c/enums/xblsocialmanagereventtype.md).

## Requirements

**Header:** social\_manager\_c.h

**Library:** Microsoft.Xbox.Services.142.C.lib or Microsoft.Xbox.Services.143.C.lib

## See also

[social\_manager\_c](https://docs.xbox.com/reference/live/xsapi-c/social_manager_c/social_manager_c_members.md)


## Related topics

- [XblSocialManagerUserGroupGetUsers](https://docs.xbox.com/reference/live/xsapi-c/social_manager_c/functions/xblsocialmanagerusergroupgetusers.md)
- [XblSocialManagerEvent](https://docs.xbox.com/reference/live/xsapi-c/social_manager_c/structs/xblsocialmanagerevent.md)
- [XblSocialManagerUpdateSocialUserGroup](https://docs.xbox.com/reference/live/xsapi-c/social_manager_c/functions/xblsocialmanagerupdatesocialusergroup.md)
- [Social Manager overview](https://docs.xbox.com/services/xbox-services/community/social-manager/live-social-manager-overview.md)
- [XblSocialManagerCreateSocialUserGroupFromFilters](https://docs.xbox.com/reference/live/xsapi-c/social_manager_c/functions/xblsocialmanagercreatesocialusergroupfromfilters.md)
