Поделиться через


GetEventsType Class

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

Namespace: ExchangeWebServices
Assembly: EWS (in ews.dll)

Syntax

'Declaration
<SerializableAttribute> _
<XmlTypeAttribute(Namespace:="https://schemas.microsoft.com/exchange/services/2006/messages")> _
<GeneratedCodeAttribute("wsdl", "2.0.50727.42")> _
<DebuggerStepThroughAttribute> _
<DesignerCategoryAttribute("code")> _
Public Class GetEventsType
    Inherits BaseRequestType
[SerializableAttribute] 
[XmlTypeAttribute(Namespace="https://schemas.microsoft.com/exchange/services/2006/messages")] 
[GeneratedCodeAttribute("wsdl", "2.0.50727.42")] 
[DebuggerStepThroughAttribute] 
[DesignerCategoryAttribute("code")] 
public class GetEventsType : BaseRequestType
[SerializableAttribute] 
[XmlTypeAttribute(Namespace=L"https://schemas.microsoft.com/exchange/services/2006/messages")] 
[GeneratedCodeAttribute(L"wsdl", L"2.0.50727.42")] 
[DebuggerStepThroughAttribute] 
[DesignerCategoryAttribute(L"code")] 
public ref class GetEventsType : public BaseRequestType
/** @attribute SerializableAttribute() */ 
/** @attribute XmlTypeAttribute(Namespace="https://schemas.microsoft.com/exchange/services/2006/messages") */ 
/** @attribute GeneratedCodeAttribute("wsdl", "2.0.50727.42") */ 
/** @attribute DebuggerStepThroughAttribute() */ 
/** @attribute DesignerCategoryAttribute("code") */ 
public class GetEventsType extends BaseRequestType
SerializableAttribute 
XmlTypeAttribute(Namespace="https://schemas.microsoft.com/exchange/services/2006/messages") 
GeneratedCodeAttribute("wsdl", "2.0.50727.42") 
DebuggerStepThroughAttribute 
DesignerCategoryAttribute("code") 
public class GetEventsType extends BaseRequestType

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.

Inheritance Hierarchy

System.Object
   ExchangeWebServices.BaseRequestType
    ExchangeWebServices.GetEventsType

Example

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 request = new GetEventsType();

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

    // Send the request and get the response.
    GetEventsResponseType response = esb.GetEvents(request);
    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 notificaton = responseMessage.Notification;
            BaseNotificationEventType[] bneta = notificaton.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 (notificaton.MoreEvents)
            {
                // TODO: Call GetEvents again with the watermark to get the
                //       remaining events.
            }
        }
    }
}

For more information about pull notifications, see Push Notification Sample Application (Exchange Web Services).

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003,

Target Platforms

Windows 98, Windows 2000, Windows 2000 Server, Windows CE, Windows Longhorn, Windows 98 Second Edition, Pocket PC, Smart Phone, Windows Server 2003, Windows XP Professional with Service Pack 2 (SP2)