通过 ews 发送房间绑定事件

Sending a room-bound event via ews

我使用 https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-create-appointments-and-meetings-by-using-ews-in-exchange-2013

发送事件

活动已创建,仅供参与者使用。房间中没有生成任何事件。如何将活动发送到房间?

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/" xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soap:Header>
      <t:RequestServerVersion Version="Exchange2007_SP1" />
      <t:TimeZoneContext>
         <t:TimeZoneDefinition Id="Pacific Standard Time" />
      </t:TimeZoneContext>
   </soap:Header>
   <soap:Body>
      <m:CreateItem SendMeetingInvitations="SendToAllAndSaveCopy">
         <m:Items>
            <t:CalendarItem>
               <t:Subject>Team building exercise</t:Subject>
               <t:Body BodyType="HTML">Let's learn to really work as a team and then have lunch!</t:Body>
               <t:ReminderMinutesBeforeStart>60</t:ReminderMinutesBeforeStart>
               <t:Start>2013-09-21T16:00:00.000Z</t:Start>
               <t:End>2013-09-21T20:00:00.000Z</t:End>
               <t:Location>Conference Room 12</t:Location>
               <t:RequiredAttendees>
                  <t:Attendee>
                     <t:Mailbox>
                        <t:EmailAddress>Mack.Chaves@contoso.com</t:EmailAddress>
                     </t:Mailbox>
                  </t:Attendee>
                  <t:Attendee>
                     <t:Mailbox>
                        <t:EmailAddress>Sadie.Daniels@contoso.com</t:EmailAddress>
                     </t:Mailbox>
                  </t:Attendee>
               </t:RequiredAttendees>
               <t:OptionalAttendees>
                  <t:Attendee>
                     <t:Mailbox>
                        <t:EmailAddress>Magdalena.Kemp@contoso.com</t:EmailAddress>
                     </t:Mailbox>
                  </t:Attendee>
               </t:OptionalAttendees>
               <t:MeetingTimeZone TimeZoneName="Pacific Standard Time" />
            </t:CalendarItem>
         </m:Items>
      </m:CreateItem>
   </soap:Body>
</soap:Envelope>

您需要使用资源元素 https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/resources 并将您的房间添加为与会者 例如

</t:OptionalAttendees>
<t:Resources>
  <t:Attendee>
    <t:Mailbox>
      <t:Name>Resource1</t:Name>
      <t:EmailAddress>resource1@contoso.com</t:EmailAddress>
      <t:RoutingType>SMTP</t:RoutingType>
      <t:MailboxType>Mailbox</t:MailboxType>
    </t:Mailbox>
    <t:ResponseType>Unknown</t:ResponseType>
  </t:Attendee>
</t:Resources>
</t:CalendarItem>