在 Exchange 中使用 EWS 建议新的会议时间

了解如何在 Exchange 中使用 EWS 从 Exchange 客户端应用程序建议新的会议时间。

建议新时间功能使与会者能够在 Exchange 日历工作流中向会议组织者建议新的会议时间。 当与会者提议新会议时,组织者可以使用建议的新会议时间更新会议,并向所有与会者发送更新。 在允许与会者建议新的会议时间之前,你需要确定组织者是否允许新的会议时间建议。 本文介绍如何确定是否可以建议新时间,以及如何使用 EWS 来建议新时间。

注意

EWS 托管 API 无法实现此功能。

确定是否可以使用 EWS 为会议建议新时间

在为会议建议新时间之前,需要查找该会议的引用,并确定会议组织者是否将会议配置为支持新的时间建议。 可以通过执行以下操作之一来获取对会议的引用:

  • 在收件箱中查找会议请求

  • 在日历中查找约会

使用以下步骤查找会议参考:

  1. 使用 FindItem EWS 操作 (或 Folder.FindItems EWS 托管 API 方法) 查找目标会议请求或日历项。 或者,可以使用 SyncFolderItems EWS 操作获取目标会议请求或日历项目的标识符。

  2. (或 Folder.FindItems 方法分析 FindItem 操作的结果,) 获取会议项目的项标识符。

  3. 使用 GetItem EWS 操作获取会议的响应对象。

以下 XML 显示发送的内容以请求项上的响应对象。

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema"
               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
               xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2013" />
    <t:MailboxCulture>en-US</t:MailboxCulture>
  </soap:Header>
  <soap:Body>
    <m:GetItem>
      <m:ItemShape>
        <t:BaseShape>IdOnly</t:BaseShape>
        <t:AdditionalProperties>
          <t:FieldURI FieldURI="item:ResponseObjects"/>
          <t:FieldURI FieldURI="item:Subject"/>
          <t:FieldURI FieldURI="calendar:Start"/>
          <t:FieldURI FieldURI="calendar:End"/>
        </t:AdditionalProperties>
      </m:ItemShape>
      <m:ItemIds>
        <t:ItemId Id="AAMkADEzOTExYjJkL1AAA=" ChangeKey="CwAAAB/G6X"/>
      </m:ItemIds>
    </m:GetItem>
  </soap:Body>
</soap:Envelope>

如果请求项目标识符、会议开始和结束时间、响应对象集合以及组织者允许对会议时间的建议更改, 则 GetItem 操作响应将类似于以下 XML。 由 ResponseObjects 元素表示的响应对象集合包含对日历项有效的响应集。 ProposeNewTime 元素是一个响应对象,指示用户可以为会议建议新的时间。 AcceptItemTentativelyAcceptItemDeclineItem 元素表示可用于向会议组织者建议新会议时间的响应对象。

<s:Envelope xmlns:s="https://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <h:ServerVersionInfo MajorVersion="15" 
                         MinorVersion="0" 
                         MajorBuildNumber="815" 
                         MinorBuildNumber="6" 
                         Version="V2_7" 
                         xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" 
                         xmlns="http://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">
    <m:GetItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" 
                       xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
      <m:ResponseMessages>
        <m:GetItemResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:Items>
            <t:MeetingRequest>
              <t:ItemId Id="AAMkADEzOTExYjJkL1AAA=" ChangeKey="CwAAAB/G6X"/>
              <t:Subject>Competitive analysis: kick off meeting</t:Subject>
              <t:ResponseObjects>
                <t:AcceptItem/>
                <t:TentativelyAcceptItem/>
                <t:DeclineItem/>
                <t:ProposeNewTime/>
                <t:ReplyToItem/>
                <t:ReplyAllToItem/>
                <t:ForwardItem/>
              </t:ResponseObjects>
              <t:Start>2013-11-09T17:00:00Z</t:Start>
              <t:End>2013-11-09T17:30:00Z</t:End>
            </t:MeetingRequest>
          </m:Items>
        </m:GetItemResponseMessage>
      </m:ResponseMessages>
    </m:GetItemResponse>
  </s:Body>
</s:Envelope>

使用 EWS 建议新的会议时间

如果在使用 GetItem 操作获取日历项或会议请求时收到 ProposNewTime 响应对象,则可以使用建议的新会议时间进行响应。 如果未收到 ProposeNewTime 响应对象,则无法在日历工作流中建议新的会议时间。 但是,你可以回复组织者以请求新的会议时间。 如果收到一个 ProposeNewTime 响应对象,可以通过引用会议标识符来响应会议,并向组织者建议新的会议时间。 这是 ProposeNewTime 响应对象与典型响应对象模式不同的地方,因为你不使用 ProposeNewTime 响应对象进行响应。 可以使用其他会议响应对象之一(如 AcceptItemTentativelyAcceptItemDeclineItem)来建议新会议。 此示例使用 AcceptItem 响应对象。

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
               xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2013"/>
  </soap:Header>
  <soap:Body>
    <m:CreateItem>
      <m:Items>
        <t:AcceptItem>
          <t:Body BodyType="Text">This time works better for the HiPPO.</t:Body>
          <t:ReferenceItemId Id="AAMkADEzOTExYjJkL1AAA=" ChangeKey="CwAAAB/G6X"/>
          <t:ProposedStart>2013-11-28T04:00:00Z</t:ProposedStart>
          <t:ProposedEnd>2013-11-28T04:30:00Z</t:ProposedEnd>
        </t:AcceptItem>
      </m:Items>
    </m:CreateItem>
  </soap:Body>
</soap:Envelope>

对此请求的响应包含已添加到与会者日历的日历项的标识符,以及放置在与会者的“已删除邮件”文件夹中的会议请求的副本。 包含新时间建议的响应消息也保存在与会者的“已发送邮件”文件夹中, (你将需要找到会议响应消息以获取) 的句柄。

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <h:ServerVersionInfo MajorVersion="15" 
                         MinorVersion="0" 
                         MajorBuildNumber="815" 
                         MinorBuildNumber="6" 
                         Version="V2_7" 
                         xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" 
                         xmlns="http://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">
    <m:CreateItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" 
                          xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
      <m:ResponseMessages>
        <m:CreateItemResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:Items>
            <t:CalendarItem>
              <t:ItemId Id="AAMkAGRmOWE2OWAAA=" ChangeKey="DwAAJsmU"/>
            </t:CalendarItem>
            <t:MeetingRequest>
              <t:ItemId Id="AAMkAGRmOWE2AAABB=" ChangeKey="AAAGJu1A"/>
            </t:MeetingRequest>
          </m:Items>
        </m:CreateItemResponseMessage>
      </m:ResponseMessages>
    </m:CreateItemResponse>
  </s:Body>
</s:Envelope>

当与会者使用建议的新会议时间做出响应时,组织者将收到 MeetingResponse 消息。 MeetingResponse 消息包含建议的新会议开始时间和结束时间,以及组织者日历中关联日历项的标识符。 组织者可以使用该信息更新其会议的现有日历项。 下面是组织者响应建议新会议时间 的 MeetingResponse 消息的工作流:

  1. 确定是否在 MeetingResponse 中设置了 ProposedStartProposedEnd 元素。 如果是,请转到步骤 2。 否则, MeetingResponse 消息仅指示与会者已接受、暂时接受或拒绝会议。

  2. 使用 AssociatedCalendarItemId 元素中返回的 EWS 标识符获取会议组织者的现有日历项。

  3. 将原始开始时间和结束时间与建议的新会议时间进行比较。 如果组织者可以接受建议的新会议时间,请转到步骤 4。 否则,会议组织者可以忽略建议的会议时间,或向建议新会议时间的与会者发送电子邮件响应。

  4. (可选) 执行 GetUserAvailability EWS 操作调用,以确定建议的时间是否适用于所有与会者,包括会议室和资源邮箱。 (还可以使用 ExchangeService.GetUserAvailability EWS 托管 API 方法执行此操作。)

  5. 然后,组织者可以使用新的建议会议时间更新会议,并使用 UpdateItem EWS 操作 (或 Appointment.Update EWS 托管 API 方法) 向所有与会者发送更新。

下图显示了会议组织者、与会者和处理 EWS 呼叫的 Exchange 服务器之间发生的过程。

图 1. 建议新会议时间的流程

此图显示计划了新的会议时间后,组织者、Exchange 和参与者之间的工作流。如果组织者允许新的会议计划,则参与者可以使用响应对象提出新的会议时间。

版本差异

Exchange 内部版本 15.00.0800.007 中引入了建议的新时间功能。 在早期版本的 Exchange 中,EWS 应用程序用户必须向会议组织者发送单独的电子邮件,以请求不同的会议时间。

另请参阅