AddNewImContactToGroup 操作AddNewImContactToGroup operation

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

AddNewImContactToGroup操作将新联系人添加到即时消息(IM)组。The AddNewImContactToGroup operation adds a new contact to an instant messaging (IM) group.

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

使用 AddNewImContactToGroup 操作Using the AddNewImContactToGroup operation

AddNewImContactToGroup操作使用以下三个参数将新联系人添加到 IM 组:The AddNewImContactToGroup operation takes the following three arguments to add a new contact to an IM group:

  • ImAddress属性-标识联系人的 IM 地址。ImAddress property - Identifies the contact's IM address. 此属性是必需的。This property is required.

  • DisplayName属性-标识联系人的显示名称。DisplayName property - Identifies the contact's display name.

  • GroupId属性-标识将联系人添加到的组。GroupId property - Identifies the group that the contact is added to.

此操作将返回已添加到组中的联系人的角色。This operation returns the persona of the contact that was added to the group.

AddNewImContactToGroup 操作 SOAP 标头AddNewImContactToGroup operation SOAP headers

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

标头名称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.

AddNewImContactToGroup 操作请求示例:向组添加新的 IM 联系人AddNewImContactToGroup operation request example: Add a new IM contact to a group

以下示例的AddNewImContactToGroup操作请求显示如何将新联系人添加到现有 IM 组。The following example of an AddNewImContactToGroup operation request shows how to add a new contact to an existing IM group. 此示例的GroupId属性值是从AddImGroup 操作的结果返回的。The GroupId property value for this example was returned from results of the AddImGroup operation. ExchangeStoreId属性包含GroupId属性值。The ExchangeStoreId property contains the GroupId property value.

<?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>
      <t:TimeZoneContext>
         <t:TimeZoneDefinition Id="GMT Standard Time"/>
      </t:TimeZoneContext>
   </soap:Header>
   <soap:Body >
      <m:AddNewImContactToGroup>
         <m:ImAddress>tsmith@contoso.com</m:ImAddress>
         <m:DisplayName>Tony Smith</m:DisplayName>
         <m:GroupId Id="AAMkAGQ1MjJjMTBkLTc4Y2UtNDAAAQKAAA="
                    ChangeKey="EgAAAA=="/>
      </m:AddNewImContactToGroup>
   </soap:Body>
</soap:Envelope>

备注

为了保持可读性, GroupId值已缩短。The GroupId value has been shortened to preserve readability.

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

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

下面的示例演示对AddNewImContactToGroup操作请求的成功响应。The following example shows a successful response to an AddNewImContactToGroup operation request. 响应包含新创建的联系人的角色。The response contains the persona of the newly created contact. 该联系人将添加到 Exchange 中的 "快速联系人" 文件夹中。The contact is added to the Quick Contacts folder in Exchange.

备注

为了保持可读性,标识符已被缩短。Identifiers have been shortened to preserve readability.

<?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="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" 
                         xmlns:h="https://schemas.microsoft.com/exchange/services/2006/types" />
  </s:Header>
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <AddNewImContactToGroupResponse ResponseClass="Success" 
                                    xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <ResponseCode>NoError</ResponseCode>
      <Persona>
        <PersonaId Id="AAQkAGQ1MjJjMTBkLTc4Y2UtNDA5Ny04ZjU5LWI3MTYzNGNkZmRkYQAQAJ3EkhEEXN5KufGbSYJanZk=" 
                   xmlns="https://schemas.microsoft.com/exchange/services/2006/types" />
        <PersonaType xmlns="https://schemas.microsoft.com/exchange/services/2006/types">Person</PersonaType>
        <CreationTime xmlns="https://schemas.microsoft.com/exchange/services/2006/types">2012-01-05T23:06:58Z</CreationTime>
        <DisplayName xmlns="https://schemas.microsoft.com/exchange/services/2006/types">Tony Smith</DisplayName>
        <DisplayNameFirstLast xmlns="https://schemas.microsoft.com/exchange/services/2006/types">Tony Smith</DisplayNameFirstLast>
        <DisplayNameLastFirst xmlns="https://schemas.microsoft.com/exchange/services/2006/types">Tony Smith</DisplayNameLastFirst>
        <FileAsId xmlns="https://schemas.microsoft.com/exchange/services/2006/types">None</FileAsId>
        <EmailAddress xmlns="https://schemas.microsoft.com/exchange/services/2006/types">
          <Name>Tony Smith</Name>
          <Address>tsmith@contoso.com</Address>
          <RoutingType>SMTP</RoutingType>
        </EmailAddress>
        <EmailAddresses xmlns="https://schemas.microsoft.com/exchange/services/2006/types">
          <EmailAddress>
            <Name>Tony Smith</Name>
            <Address>tsmith@contoso.com</Address>
            <RoutingType>SMTP</RoutingType>
          </EmailAddress>
        </EmailAddresses>
        <ImAddress xmlns="https://schemas.microsoft.com/exchange/services/2006/types">tsmith@contoso.com</ImAddress>
        <RelevanceScore xmlns="https://schemas.microsoft.com/exchange/services/2006/types">2147483647</RelevanceScore>
        <Attributions xmlns="https://schemas.microsoft.com/exchange/services/2006/types">
          <Attribution>
            <Id>0</Id>
            <SourceId Id="BtF8oI7iVOQatt/bhQoTbWAAAAAAvcAAA=" 
                      ChangeKey="EQAAABYAAABtF8oIQoTbWAAAAAAyg" />
            <DisplayName>Outlook</DisplayName>
            <IsWritable>true</IsWritable>
            <IsQuickContact>true</IsQuickContact>
            <IsHidden>false</IsHidden>
            <FolderId Id="AAMkAGQ1MjJjMTBkLTc4YhQoTbWAAAAAAvZAAA=" 
                      ChangeKey="AQAAAA==" />
          </Attribution>
        </Attributions>
        <DisplayNames xmlns="https://schemas.microsoft.com/exchange/services/2006/types">
          <StringAttributedValue>
            <Value>Tony Smith</Value>
            <Attributions>
              <Attribution>0</Attribution>
            </Attributions>
          </StringAttributedValue>
        </DisplayNames>
        <FileAsIds xmlns="https://schemas.microsoft.com/exchange/services/2006/types">
          <StringAttributedValue>
            <Value>None</Value>
            <Attributions>
              <Attribution>0</Attribution>
            </Attributions>
          </StringAttributedValue>
        </FileAsIds>
        <Emails1 xmlns="https://schemas.microsoft.com/exchange/services/2006/types">
          <EmailAddressAttributedValue>
            <Value>
              <Name>Tony Smith</Name>
              <Address>tsmith@contoso.com</Address>
              <RoutingType>SMTP</RoutingType>
            </Value>
            <Attributions>
              <Attribution>0</Attribution>
            </Attributions>
          </EmailAddressAttributedValue>
        </Emails1>
        <ImAddresses xmlns="https://schemas.microsoft.com/exchange/services/2006/types">
          <StringAttributedValue>
            <Value>tsmith@contoso.com</Value>
            <Attributions>
              <Attribution>0</Attribution>
            </Attributions>
          </StringAttributedValue>
        </ImAddresses>
      </Persona>
    </AddNewImContactToGroupResponse>
  </s:Body>
</s:Envelope>

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

AddNewImContactToGroup 操作错误响应AddNewImContactToGroup operation error response

下面的示例演示对AddNewImContactToGroup操作请求的错误响应。The following example shows an error response to a AddNewImContactToGroup operation request. 这是对向不在请求者邮箱中的组添加联系人的请求的响应。This is a response to a request to add a contact to a group that is not in the requester's mailbox.

<?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="578" 
                           MinorBuildNumber="11" 
                           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">
      <AddNewImContactToGroupResponse ResponseClass="Error" 
                                      xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
         <MessageText>No mailbox with such guid.</MessageText>
         <ResponseCode>ErrorNonExistentMailbox</ResponseCode>
         <DescriptiveLinkKey>0</DescriptiveLinkKey>
         <MessageXml>
            <t:Value Name="MailboxGuid" xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">d5fasdadcw3d-23de-2341-8f59-b71523fsddda</t:Value>
         </MessageXml>
      </AddNewImContactToGroupResponse>
   </s:Body>
</s:Envelope>

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

有关对 EWS 通用的其他错误代码以及特定于此操作的错误代码,请参阅ResponseCodeFor additional error codes that are generic to EWS and specific to this operation, see ResponseCode.

另请参阅See also

AddImGroup 操作AddImGroup operation

AddImContactToGroup 操作AddImContactToGroup operation

AddImGroup 操作AddImGroup operation

RemoveImGroup 操作RemoveImGroup operation

SetImGroup 操作SetImGroup operation

人员和 Exchange 中的 EWS 中的联系人People and contacts in EWS in Exchange