Sdílet prostřednictvím


Handling Meetings (Exchange Web Services)

Topic Last Modified: 2007-09-17

This walkthrough shows you how to create a meeting, send the meeting invitations to attendees, and schedule resources. This walkthrough includes the following tasks:

  • Creating a meeting (organizing a meeting)
  • Sending meeting invitations to attendees
  • Receiving and accepting meeting invitations
  • Receiving and tentatively accepting meeting invitations
  • Checking attendee status
  • Updating a calendar item based on attendee responses
  • Updating a meeting
  • Adding attendees
  • Receiving meeting cancellations and removing the calendar item

Prerequisites

This walkthrough requires the following:

  • Microsoft Exchange Server 2007
  • Mailbox accounts for an organizer, attendees, and resources

Creating a Meeting

To create and send a meeting

  • Create a calendar item that includes required and optional attendees, and a room resource. This request sends the meeting invitation to all attendees. The following is an example of a meeting request.

    <CreateItem
           xmlns="https://schemas.microsoft.com/exchange/services/2006/messages"
           SendMeetingInvitations="SendToAllAndSaveCopy" >
      <SavedItemFolderId>
        <t:DistinguishedFolderId Id="calendar"/>
      </SavedItemFolderId>
      <Items>
        <t:CalendarItem>
          <t:Subject>Meeting with attendee0, attendee1, attendee2</t:Subject>
          <t:Body BodyType="Text">CalendarItem:TextBody</t:Body>
          <t:Start>2006-06-25T10:00:00Z</t:Start>
          <t:End>2006-06-25T11:00:00Z</t:End>
          <t:Location>CalendarItem:Location</t:Location>
          <t:RequiredAttendees>
            <t:Attendee>
              <t:Mailbox>
                <t:EmailAddress>attendee0@example.com</t:EmailAddress>
              </t:Mailbox>
            </t:Attendee>
            <t:Attendee>
              <t:Mailbox>
                <t:EmailAddress>attendee1@example.com</t:EmailAddress>
              </t:Mailbox>
            </t:Attendee>
          </t:RequiredAttendees>
          <t:OptionalAttendees>
            <t:Attendee>
              <t:Mailbox>
                <t:EmailAddress>attendee2@example.com</t:EmailAddress>
              </t:Mailbox>
            </t:Attendee>
          </t:OptionalAttendees>
          <t:Resources>
            <t:Attendee>
              <t:Mailbox>
                <t:EmailAddress>room0@example.com</t:EmailAddress>
              </t:Mailbox>
            </t:Attendee>
          </t:Resources>
        </t:CalendarItem>
      </Items>
    </CreateItem>
    

    The following is an example of a response that contains the identifier of the calendar item that you created.

    <CreateItemResponse xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages" 
                        xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" 
                        xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <m:ResponseMessages>
        <m:CreateItemResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:Items>
            <t:CalendarItem>
              <t:ItemId Id="AS0Ab3=" ChangeKey="DwAAAB"/>
            </t:CalendarItem>
          </m:Items>
        </m:CreateItemResponseMessage>
      </m:ResponseMessages>
    </CreateItemResponse>
    

    Note

    If you perform a FindItem search in the Calendar, Sent Items, and Inbox folders, the calendar item and meeting request will be available.

Receiving and Accepting the Meeting

To receive and accept the meeting invitation

  1. Attendee 0 performs a FindItem request on the Inbox and Calendar. The response to the FindItem request contains the meeting request found in the Inbox and the calendar item found in the Calendar. The calendar item has a status of tentatively accepted. For more information, see FindItem, FindItem Operation and Finding Items (Exchange Web Services).

    Note

    If a GetItem request is performed on the meeting request, the available response objects will be enumerated.

  2. Attendee 0 uses the AcceptItem response object to accept the meeting invitation. The following is an example that shows the use of the AcceptItem response object in the request to accept the meeting invitation. The ReferenceItemId element contains the identifier to the meeting request.

    <CreateItem xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" 
              xmlns="https://schemas.microsoft.com/exchange/services/2006/messages"
                MessageDisposition="SendAndSaveCopy">
      <Items>
        <t:AcceptItem>
          <t:ReferenceItemId Id="ASwAYX" ChangeKey="CwAAAB"/>
        </t:AcceptItem>
      </Items>
    </CreateItem>
    

    Note

    To tentatively accept or decline the meeting invitation, the attendee can use the TentativelyAcceptItem or DeclineItem element instead of the AcceptItem element.

The response to the CreateItem request to accept the meeting invitation contains the identifier and updated change key of the meeting request.

If the attendee performs another FindItem request on the Calendar, Sent Items, Deleted Items, and Inbox folders, the response will contain the updated calendar item that represents the meeting, the meeting response that was sent to the organizer, and the deleted meeting request in the Deleted Items folder.

Checking Attendee Responses

To check attendee responses and get the updated calendar item

  1. Perform a FindItem request on the Inbox, Calendar, Sent Items, and Deleted Items folders. The Inbox will contain the meeting responses from the attendees. The Calendar will have the updated calendar item. The Sent Items will contain the meeting request.

  2. Get the updated calendar item by using the GetItem request. The GetItem response describes the available response objects for the calendar item and how the each attendee responded to the request.

    The following example shows the response to a GetItem request. Note that the CancelCalendarItem and ForwardItem response objects are available. Also note the response for each attendee.

    Note

    This example has been shortened to preserve readability.

    <CalendarItem>
      <ItemId Id="A0AAIg=" ChangeKey="GUomp"/>
      <ParentFolderId Id="AS0Abg" ChangeKey="AQAAAA=="/>
      <ItemClass>IPM.Appointment</ItemClass>
      <Subject>Meeting with attendee0, attendee1, attendee2</Subject>
      <ResponseObjects>
        <CancelCalendarItem/>
        <ForwardItem/>
      </ResponseObjects>
      <Start>2006-06-25T10:00:00Z</Start>
      <End>2006-06-25T11:00:00Z</End>
      <MeetingRequestWasSent>true</MeetingRequestWasSent>
      <CalendarItemType>Single</CalendarItemType>
      <MyResponseType>Organizer</MyResponseType>
      <Organizer>
        <Mailbox>
          <Name>Organizer 0</Name>
          <EmailAddress>organizer0@example.com</EmailAddress>
          <RoutingType>SMTP</RoutingType>
        </Mailbox>
      </Organizer>
      <RequiredAttendees>
        <Attendee>
          <Mailbox>
            <Name>Attendee 0</Name>
            <EmailAddress>attendee0@example.com</EmailAddress>
            <RoutingType>SMTP</RoutingType>
          </Mailbox>
          <ResponseType>Accept</ResponseType>
          <LastResponseTime>2006-06-19T20:43:04Z</LastResponseTime>
        </Attendee>
        <Attendee>
          <Mailbox>
            <Name>Attendee 1</Name>
            <EmailAddress>attendee1@example.com</EmailAddress>
            <RoutingType>SMTP</RoutingType>
          </Mailbox>
          <ResponseType>Tentative</ResponseType>
          <LastResponseTime>2006-06-19T21:07:03Z</LastResponseTime>
        </Attendee>
      </RequiredAttendees>
      <OptionalAttendees>
        <Attendee>
          <Mailbox>
            <Name>attendee 2</Name>
            <EmailAddress>attendee2@example.com</EmailAddress>
            <RoutingType>SMTP</RoutingType>
          </Mailbox>
          <ResponseType>Decline</ResponseType>
          <LastResponseTime>2006-06-19T21:57:48Z</LastResponseTime>
        </Attendee>
      </OptionalAttendees>
      <Resources>
        <Attendee>
          <Mailbox>
            <Name>room0@example.com</Name>
            <EmailAddress>room0@example.com</EmailAddress>
            <RoutingType>SMTP</RoutingType>
          </Mailbox>
          <ResponseType>Unknown</ResponseType>
        </Attendee>
      </Resources>
      <ConflictingMeetingCount>0</ConflictingMeetingCount>
      <AdjacentMeetingCount>0</AdjacentMeetingCount>
    </CalendarItem>
    

Updating the Meeting

To update the meeting to include a new attendee

  • Perform an UpdateItem request on the calendar item that represents the meeting. The following example shows the addition of a new attendee to the meeting. The updates are sent to the attendees.

    <UpdateItem xmlns="https://schemas.microsoft.com/exchange/services/2006/messages"
        ConflictResolution="AlwaysOverwrite"
        SendMeetingInvitationsOrCancellations="SendToAllAndSaveCopy">
      <ItemChanges>
        <ItemChange>
          <ItemId Id="AS0Ab3J" ChangeKey="AAGUomp" />
          <Updates>
            <SetItemField>
              <FieldURI FieldURI="item:Subject" />
              <CalendarItem>
                <Subject>Meeting with attendee1, attendee2, attendee3</Subject>
              </CalendarItem>
            </SetItemField>
            <SetItemField>
              <FieldURI FieldURI="calendar:RequiredAttendees" />
              <CalendarItem>
                <RequiredAttendees>
                  <Attendee>
                    <Mailbox>
                      <EmailAddress>attendee0@example.com</EmailAddress>
                    </Mailbox>
                  </Attendee>
                </RequiredAttendees>
              </CalendarItem>
            </SetItemField>
            <AppendToItemField>
              <FieldURI FieldURI="calendar:OptionalAttendees" />
              <CalendarItem>
                <OptionalAttendees>
                  <Attendee>
                    <Mailbox>
                      <EmailAddress>attendee3@example.com</EmailAddress>
                    </Mailbox>
                  </Attendee>
                </OptionalAttendees>
              </CalendarItem>
            </AppendToItemField>
          </Updates>
        </ItemChange>
      </ItemChanges>
    </UpdateItem>
    

You can now do a GetItem request on the calendar item to get the latest status of the meeting.

Removing the Calendar Item

To remove the calendar item

  1. The attendee who was removed from the meeting uses the FindItem operation to find the meeting cancellation in the Inbox.

  2. The attendee gets the meeting cancellation by using the GetItem operation.

  3. The meeting cancellation identifier is used with the RemoveItem response object to remove the calendar item from the attendee's calendar. The following example shows the use of the RemoveItem response object.

    <CreateItem xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" 
                xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <Items>
        <t:RemoveItem>
          <t:ReferenceItemId Id="ASwAYXA" ChangeKey="DQAAABY"/>
        </t:RemoveItem>
      </Items>
    </CreateItem>
    

Remarks

For more information about the operations and elements that are used in this walkthrough, see Web Services Reference.