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

# XblMultiplayerSendInvitesAsync

> XblMultiplayerSendInvitesAsync

# XblMultiplayerSendInvitesAsync

邀请指定用户加入会话。这将向每个被邀请的用户显示带有标准邀请文本的通知。如果用户接受该通知，则将激活标题。

## 语法

```cpp theme={null}
HRESULT XblMultiplayerSendInvitesAsync(  
         XblContextHandle xblContext,  
         const XblMultiplayerSessionReference* sessionReference,  
         const uint64_t* xuids,  
         size_t xuidsCount,  
         uint32_t titleId,  
         const char* contextStringId,  
         const char* customActivationContext,  
         XAsyncBlock* async  
)  
```

### 参数

*xblContext*   \_In\_\
类型：[XblContextHandle](/reference/live/xsapi-c/types_c/handles/xblcontexthandle)

本地用户的 XBOX Live 上下文。

*sessionReference*   \_In\_\
类型：[XblMultiplayerSessionReference\*](/reference/live/xsapi-c/multiplayer_c/structs/xblmultiplayersessionreference)

一个 XblMultiplayerSessionReference 对象，表示目标用户将被邀请加入的会话。

*xuids*   \_In\_\
类型：uint64\_t\*

将被邀请的 XBOX 用户 ID 列表。

*xuidsCount*   \_In\_\
类型：size\_t

xuids 数组的大小。

*titleId*   \_In\_\
类型：uint32\_t

被邀请的用户将激活以加入会话的标题的 ID。

*contextStringId*   \_In\_opt\_z\_\
类型：char\*

自定义上下文字符串 ID。此字符串 ID 在 XBOX Live 引入期间定义，用于标识除标准邀请文本之外的附加邀请文本。ID 字符串必须以 " /// " 为前缀。如果不希望在邀请中添加自定义字符串，请传递 nullptr。

*customActivationContext*   \_In\_opt\_z\_\
类型：char\*

激活上下文字符串。由游戏定义的字符串，传递到被邀请的游戏客户端并按需解释。（可选）

*async*   \_In\_\
类型：XAsyncBlock\*

此操作的 AsyncBlock。

### 返回值

类型：HRESULT

此 API 操作的 HRESULT 返回代码。

## 要求

**头文件：** multiplayer\_c.h

**库：** Microsoft.Xbox.Services.14x.GDK.C.lib

## 概念性文档

* [发送邀请](/services/xbox-services/multiplayer/invites/how-to/live-invites-send)

## 另请参阅

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


## Related topics

- [发送邀请](/zh-CN/services/xbox-services/multiplayer/invites/how-to/live-invites-send.md)
- [从 MPSD 迁移到 PlayFab Multiplayer 和 MPA](/zh-CN/services/xbox-services/multiplayer/mpsd/concepts/live-mpsd-to-mlp.md)
- [多人游戏会话目录概述](/zh-CN/services/xbox-services/multiplayer/mpsd/live-mpsd-overview.md)
- [多人游戏任务](/zh-CN/services/xbox-services/multiplayer/mpsd/how-to/live-mpsd-how-tos.md)
- [调用 XBOX 服务的最佳实践](/zh-CN/services/xbox-services/develop/best-practices/live-best-practices-calling-xbl.md)
