Edit

Share via


GetEventsType Class

Definition

The GetEventsType class represents a request to get events for a pull notification subscription.

public ref class GetEventsType : ExchangeWebServices::BaseRequestType
public class GetEventsType : ExchangeWebServices.BaseRequestType
Public Class GetEventsType
Inherits BaseRequestType
Inheritance
GetEventsType

Examples

The following example shows you how to compose a request to get the events for a pull notification subscription. The watermark that is used to build the request must be the last watermark that is returned in the last GetEvents call or, if this is the first GetEvents call, the watermark from the Subscribe response. The watermark of the last event should be saved to be used for the next call to GetEvents.

static void GetEvents(ExchangeServiceBinding esb)
{ 
    // Create the GetEvents request.
    GetEventsType <span class="label">request</span> = new GetEventsType();

    // Identify the subscription identifier and watermark for the subscription 
    // that will be polled for changes in the Exchange store.
<span class="label">request</span>.SubscriptionId = "2448550a-4685-412c-bc40-62f0999a8bdb";
<span class="label">request</span>.Watermark = "AQAAAM/SnQORsD1IqTUHelGT0oxxHQAAAAAAAAE=";

    // Send the request and get the response.
    GetEventsResponseType response = esb.GetEvents(<span class="label">request</span>);
    ArrayOfResponseMessagesType aormt = response.ResponseMessages;
    ResponseMessageType[] rmta = aormt.Items;

    foreach (ResponseMessageType rmt in rmta)
    {
        // Determine whether the request was a success.
        if (rmt.ResponseClass == ResponseClassType.Success)
        {
            // Cast to appropriate response message type.
            GetEventsResponseMessageType responseMessage = (rmt as GetEventsResponseMessageType);

            // Get the notifications.
            NotificationType notification = responseMessage.Notification;
            BaseNotificationEventType[] bneta = notification.Items;

            foreach (BaseNotificationEventType bnet in bneta)
            {
                // TODO: Handle each notification. Refer to the Push Notification 
                //       sample for an example of how to do this.
            }

            if (notification.MoreEvents)
            {
                // TODO: Call GetEvents again with the watermark to get the
                //       remaining events.
            }
        }
    }
}

For more information about pull notifications, see Push Notification Sample Application.

Remarks

Changes to calendar items may result in the generation of multiple events. Operations on other items can also generate multiple low-level events. These events are the result of the creation of temporary items in the mailbox and changes to free/busy data storage items as part of the usual Calendar operations, or both. Events for item class IPM.SchedulePlus.FreeBusy.BinaryData should be ignored by Web services clients. These temporary items are deleted after they are created. If an attempt is made to retrieve these items, an error will be returned that states that the item was not found.

Constructors

GetEventsType()

The GetEventsType constructor initializes a new instance of the GetEventsType class.

Properties

SubscriptionId

The SubscriptionId property gets or sets the identifier of a subscription. This property is required. This is a read/write property.

Watermark

The Watermark property gets or sets a string that represents an event bookmark in the mailbox event queue. This property is required. This is a read/write property.

Applies to