AddImContactToGroup 操作AddImContactToGroup operation

查找有关AddImContactToGroup EWS 操作的信息。Find information about the AddImContactToGroup EWS operation.

AddImContactToGroup Exchange Web 服务(EWS)操作将现有的即时消息(IM)联系人添加到组中。The AddImContactToGroup Exchange Web Services (EWS) operation adds an existing instant messaging (IM) contact to a group.

Exchange Server 2013 中引入了此操作。This operation was introduced in Exchange Server 2013.

使用 AddImContactToGroup 操作Using the AddImContactToGroup operation

AddImContactToGroup操作只能接受 IM 联系人。The AddImContactToGroup operation can only accept IM contacts. 如果要将新的 IM 联系人添加到统一联系人存储中,请使用AddNewImContactToGroup操作。If you want to add a new IM contact to the Unified Contact Store, use the AddNewImContactToGroup operation.

AddImContactToGroup操作可以使用下表中列出的 SOAP 标头。The AddImContactToGroup operation can use the SOAP headers that are listed in the following table.

表1。AddImContactToGroup 操作 SOAP 标头Table 1. AddImContactToGroup operation SOAP headers

标头名称Header name 元素Element 说明Description
模拟Impersonation
ExchangeImpersonationExchangeImpersonation
标识客户端应用程序模拟的用户。Identifies the user whom the client application is impersonating. 此标头适用于请求。This header is applicable to a request.
MailboxCultureMailboxCulture
MailboxCultureMailboxCulture
确定用于访问邮箱的区域性(如 RFC 3066 中定义的用于标识语言的标记)。Identifies the culture, as defined in RFC 3066, "Tags for the Identification of Languages", to be used to access the mailbox. 此标头适用于请求。This header is applicable to a request.
RequestVersionRequestVersion
RequestServerVersionRequestServerVersion
标识操作请求的架构版本。Identifies the schema version for the operation request. 此标头适用于请求。This header is applicable to a request.
ServerVersionServerVersion
ServerVersionInfoServerVersionInfo
标识响应请求的服务器版本。Identifies the version of the server that responded to the request. 此标头适用于响应。This header is applicable to a response.

AddImContactToGroup 操作请求示例:将现有 IM 联系人添加到 IM 组AddImContactToGroup operation request example: Add an existing IM contact to an IM group

以下示例的AddImContactToGroup操作请求显示如何添加现有 im 联系人的 im 组。The following example of an AddImContactToGroup operation request shows how to add an existing IM contact an IM group.

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types"
               xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages">
   <soap:Header>
      <t:RequestServerVersion Version="Exchange2013" />
      <t:MailboxCulture>en-US</t:MailboxCulture>
   </soap:Header>
   <soap:Body >
      <m:AddImContactToGroup>
         <m:ContactId Id="AAMkAGQ1MjJjMTBkLTc4Y2AA="
                      ChangeKey="EQAAABYAAABtF8oI7i"/>
         <m:GroupId Id="AAMkAGQ1MjJjMTBkzzAAAQKAAA="
                    ChangeKey="EgAAAA=="/>
      </m:AddImContactToGroup>
   </soap:Body>
</soap:Envelope>

请求 SOAP 正文包含以下元素:The request SOAP body contains the following elements:

成功的 AddImContactToGroup 操作响应Successful AddImContactToGroup operation response

下面的示例演示对AddImContactToGroup操作请求的成功响应。The following example shows a successful response to an AddImContactToGroup operation request.

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
      <h:ServerVersionInfo MajorVersion="15" 
                           MinorVersion="0" 
                           MajorBuildNumber="349" 
                           MinorBuildNumber="0" 
                           Version="Exchange2013" 
                           xmlns:h="https://schemas.microsoft.com/exchange/services/2006/types" 
                           xmlns="https://schemas.microsoft.com/exchange/services/2006/types" 
                           xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
           xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <AddImContactToGroupResponse ResponseClass="Success" 
                                   xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
         <ResponseCode>NoError</ResponseCode>
      </AddImContactToGroupResponse>
   </s:Body>
</s:Envelope>

响应 SOAP 正文包含以下元素:The response SOAP body contains the following elements:

AddImContactToGroup 操作 ErrorInvalidImContactId 错误响应AddImContactToGroup operation ErrorInvalidImContactId error response

下面的示例演示对AddImContactToGroup操作请求的错误响应。The following example shows an error response to an AddImContactToGroup operation request. 当尝试添加不是 IM 联系人的联系人时,将发生以下错误响应。The following error response occurs when an attempt is made to add a contact that is not an IM contact.

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
      <h:ServerVersionInfo MajorVersion="15"
                           MinorVersion="0" 
                           MajorBuildNumber="349" 
                           MinorBuildNumber="0" 
                           Version="Exchange2013" 
                           xmlns:h="https://schemas.microsoft.com/exchange/services/2006/types"
                           xmlns="https://schemas.microsoft.com/exchange/services/2006/types" 
                           xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
           xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <AddImContactToGroupResponse ResponseClass="Error" 
                                   xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
         <MessageText>The specified Im Contact Id is invalid.</MessageText>
         <ResponseCode>ErrorInvalidImContactId</ResponseCode>
         <DescriptiveLinkKey>0</DescriptiveLinkKey>
         </AddImContactToGroupResponse>
      </s:Body>
</s:Envelope>

错误响应 SOAP 正文包含以下元素:The error response SOAP body contains the following elements:

另请参阅See also