GetStreamingEvents Operation

Last modified: September 24, 2010

Applies to: Exchange Server 2007 | Exchange Server 2010

In this article
GetStreamingEvents Request Example
Successful GetStreamingEvents Response Example
GetStreamingEvents Error Response Example

The GetStreamingEvents operation is used by streaming subscription clients to request notifications from the Client Access server. The GetStreamingEvents response returns an array of items and events that have occurred in a mailbox since the last the notification.

GetStreamingEvents Request Example

Description

The following example of a GetStreamingEvents operation shows how to request the events and items that are associated with a subscription that is identified by the subscription identifier.

Code

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/"
  xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types"
  xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages">
  <soap:Body>
    <GetStreamingEvents xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <SubscriptionId>f6bc657d-dde1-4f94-952d-143b95d6483d</SubscriptionId>
      <ConnectionTimeout>30</ConnectionTimeout>
    </GetStreamingEvents>
  </soap:Body>
</soap:Envelope>

GetStreamingEvents Request Elements

The following elements are used in the request:

Successful GetStreamingEvents Response Example

Description

The following example of a GetStreamingEvents response shows a notification of the existence of two new mail messages since the last notification request was sent to the server.

Code

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/" 
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <t:ServerVersionInfo MajorVersion="8" MinorVersion="0" MajorBuildNumber="628" MinorBuildNumber="0" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <GetStreamingEventsResponse 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:GetStreamingEventsResponseMessage ResponseClass="Success">
<m:MessageText></m:MessageText>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:ResponseCode>NoError</m:ResponseCode>
<m:ConnectionStatus>OK</m:ConnectionStatus>
</m:GetStreamingEventsResponseMessage>
</m:ResponseMessages>

    </GetStreamingEventsResponse>
  </soap:Body>
</soap:Envelope>

Comments

Note

The item and folder identifiers have been shortened to preserve readability.

GetStreamingEvents Response Elements

The following elements are used in the response:

To find other options for the response message of the GetStreamingEvents operation, explore the schema hierarchy. Start at the Notification element.

GetStreamingEvents Error Response Example

Description

The following example shows an error response to a GetStreamingEvents request.

Code

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/" 
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <t:ServerVersionInfo MajorVersion="8" MinorVersion="0" MajorBuildNumber="628" MinorBuildNumber="0" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <GetStreamingEventsResponse 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:GetStreamingEventsResponseMessage ResponseClass="Error">
<m:MessageText></m:MessageText>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:ResponseCode>ErrorInvalidSubscription</m:ResponseCode>
<m:ConnectionStatus>Closed</m:ConnectionStatus>
</m:ResponseMessages>

    </GetStreamingEventsResponse>
  </soap:Body>
</soap:Envelope>

Remarks

When processing a GetStreamingEvents request, the Client Access server performs the following steps:

  1. The SubscriptionId of the request is confirmed to be a valid subscription that is hosted on the Client Access server. If it is not, the GetStreamingEvents call fails.

  2. The SMTP address of the authenticated user for the request is validated to have impersonation rights. If they do not, the GetStreamingEvents request fails.

  3. The subscription queue is queried for events that are waiting to be sent to the client. If the queue is not empty, the first 50 events from the queue are pulled from the queue and encoded into a notification.

  4. If no events are found in the queue, a StatusEvent is generated and encoded into a notification response.

  5. The notification response is returned to the client.

  6. The events that are included in the notification are removed from the subscription queue and the Client Access server–local last watermark for the subscription is set to the watermark of the last event that is returned.

  7. The timeout timer for the subscription is reset.