Tracking meeting responses by using the EWS Managed API 2.0
Last modified: October 13, 2012
Applies to: EWS Managed API | Exchange Server 2007 Service Pack 1 (SP1) | Exchange Server 2010
Note: This content applies to the EWS Managed API 2.0 and earlier versions. For the latest information about the EWS Managed API, see Web services in Exchange.
In Exchange Web Services, a calendar item can represent a meeting between multiple parties. Meeting attendees are stored on the calendar item in one of three collections. These collections are listed in the following table.
Collection name |
Description |
---|---|
RequiredAttendees |
Contains attendees who must attend the meeting. |
OptionalAttendees |
Contains attendees who are not required to attend the meeting. |
Resources |
Contains meeting resources such as meeting rooms or equipment. |
When an attendee responds to a meeting request, the response is stored within the associated attendee collection on the meeting organizer's meeting item. You can use the Microsoft Exchange Web Services (EWS) Managed API to review attendees' responses to meeting requests.
To review attendee responses
Bind to the meeting organizer's meeting item by using its unique identifier. The following code shows how to bind to an existing meeting item and provide it with connection configuration information by using an ExchangeService object named service. The ItemId has been shortened to preserve readability.
Appointment meeting = Appointment.Bind(service, new ItemId("AAMkA="));
Iterate through each attendee’s collection, checking the response for each attendee. The following code shows how to iterate through the RequiredAttendees, OptionalAttendees, and Resources collections on the meeting organizer's meeting item. Each attendee's response is written to the console.
// Check responses from required attendees. for (int i = 0; i < meeting.RequiredAttendees.Count; i++) { Console.WriteLine("Required attendee - " + meeting.RequiredAttendees[i].Address + ": " + meeting.RequiredAttendees[i].ResponseType.Value.ToString()); } // Check responses from optional attendees. for (int i = 0; i < meeting.OptionalAttendees.Count; i++) { Console.WriteLine("Optional attendee - " + meeting.OptionalAttendees[i].Address + ": " + meeting.OptionalAttendees[i].ResponseType.Value.ToString()); } // Check responses from resources. for (int i = 0; i < meeting.Resources.Count; i++) { Console.WriteLine("Resource attendee - " + meeting.Resources[i].Address + ": " + meeting.Resources[i].ResponseType.Value.ToString()); }
For information about the possible values for ResponseType, see MeetingResponseType.
Example
The following example shows the XML that is sent by using the Bind method. The ItemId attribute has been shortened to preserve readability.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types"
xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2010" />
</soap:Header>
<soap:Body>
<m:GetItem>
<m:ItemShape>
<t:BaseShape>AllProperties</t:BaseShape>
</m:ItemShape>
<m:ItemIds>
<t:ItemId Id="AAMkA=" />
</m:ItemIds>
</m:GetItem>
</soap:Body>
</soap:Envelope>
The following example shows the XML that is returned by using the Bind method. The ItemId and ChangeKey attributes have been shortened and several elements within CalendarItem have been omitted to preserve readability. Required attendee User1 has accepted the meeting invitation, required attendee User2 has tentatively accepted the meeting invitation, and optional attendee User3 has declined the meeting invitation. Optional attendee User4 and resource attendee Resource1 have not yet responded to the meeting invitation.
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="https://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="14" MinorVersion="0" MajorBuildNumber="478" MinorBuildNumber="0" Version="Exchange2010"
xmlns:h="https://schemas.microsoft.com/exchange/services/2006/types"
xmlns="https://schemas.microsoft.com/exchange/services/2006/types"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
</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="https://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:GetItemResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Items>
<t:CalendarItem>
<t:ItemId Id="AAMkA=" ChangeKey="DwAAA" />
<t:ParentFolderId Id="AAMkA=" ChangeKey="AQAAAA=" />
<t:ItemClass>IPM.Appointment</t:ItemClass>
<t:Subject>Tuesday Status Meeting</t:Subject>
<t:Sensitivity>Normal</t:Sensitivity>
<t:Body BodyType="Text">The purpose of this meeting is to discuss project status.</t:Body>
<t:RequiredAttendees>
<t:Attendee>
<t:Mailbox>
<t:Name>User1</t:Name>
<t:EmailAddress>user1@contoso.com</t:EmailAddress>
<t:RoutingType>SMTP</t:RoutingType>
<t:MailboxType>Mailbox</t:MailboxType>
</t:Mailbox>
<t:ResponseType>Accept</t:ResponseType>
<t:LastResponseTime>2008-12-16T22:20:37Z</t:LastResponseTime>
</t:Attendee>
<t:Attendee>
<t:Mailbox>
<t:Name>User2</t:Name>
<t:EmailAddress>user2@contoso.com</t:EmailAddress>
<t:RoutingType>SMTP</t:RoutingType>
<t:MailboxType>Mailbox</t:MailboxType>
</t:Mailbox>
<t:ResponseType>Tentative</t:ResponseType>
<t:LastResponseTime>2008-12-16T22:21:00Z</t:LastResponseTime>
</t:Attendee>
</t:RequiredAttendees>
<t:OptionalAttendees>
<t:Attendee>
<t:Mailbox>
<t:Name>User3</t:Name>
<t:EmailAddress>user3@contoso.com</t:EmailAddress>
<t:RoutingType>SMTP</t:RoutingType>
<t:MailboxType>Mailbox</t:MailboxType>
</t:Mailbox>
<t:ResponseType>Decline</t:ResponseType>
<t:LastResponseTime>2008-12-16T22:21:29Z</t:LastResponseTime>
</t:Attendee>
<t:Attendee>
<t:Mailbox>
<t:Name>User4</t:Name>
<t:EmailAddress>user4@contoso.com</t:EmailAddress>
<t:RoutingType>SMTP</t:RoutingType>
<t:MailboxType>Mailbox</t:MailboxType>
</t:Mailbox>
<t:ResponseType>Unknown</t:ResponseType>
</t:Attendee>
</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>
</m:Items>
</m:GetItemResponseMessage>
</m:ResponseMessages>
</m:GetItemResponse>
</s:Body>
</s:Envelope>
Compiling the code
For information about compiling this code, see Getting started with the EWS Managed API 2.0.
Robust programming
Write appropriate error handling code for common search errors.
Review the client request XML that is sent to the Exchange server.
Review the server response XML that is sent from the Exchange server.
Set the service binding as shown in Setting the Exchange service URL by using the EWS Managed API 2.0. Do not hard code URLs because if mailboxes move, they might be serviced by a different Client Access server. If the client cannot connect to the service, retry setting the binding by using the AutodiscoverUrl(String) method.
Set the target Exchange Web Services schema version by setting the requestedServerVersion parameter of the ExchangeService constructor. For more information, see Versioning EWS requests by using the EWS Managed API 2.0.
Security
Use HTTP with SSL for all communication between client and server.
Always validate the server certificate that is used for establishing the SSL connections. For more information, see Validating X509 certificates by using the EWS Managed API 2.0.
Do not include user names and passwords in trace files.
Verify that Autodiscover lookups that use HTTP GET to find an endpoint always prompt for user confirmation; otherwise, they should be blocked.