Compartilhar via


GetEventsType Classe

Definição

A GetEventsType classe representa um pedido para obter eventos para uma subscrição de notificação Pull.

public ref class GetEventsType : ExchangeWebServices::BaseRequestType
public class GetEventsType : ExchangeWebServices.BaseRequestType
Public Class GetEventsType
Inherits BaseRequestType
Herança
GetEventsType

Exemplos

O exemplo seguinte mostra-lhe como compor um pedido para obter os eventos de uma subscrição de notificação Pull. A marca d'água utilizada para criar o pedido tem de ser a última marca d'água devolvida na última chamada GetEvents ou, se esta for a primeira chamada GetEvents, a marca d'água da resposta Subscrever. A marca d'água do último evento deve ser guardada para ser utilizada para a próxima chamada para 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.
            }
        }
    }
}

Para obter mais informações sobre notificações Pull, veja Aplicação de Exemplo de Notificação Push.

Comentários

As alterações aos itens de calendário podem resultar na geração de vários eventos. As operações noutros itens também podem gerar vários eventos de baixo nível. Estes eventos são o resultado da criação de itens temporários na caixa de correio e alterações a itens de armazenamento de dados de disponibilidade como parte das operações habituais do Calendário, ou ambos. Eventos para a classe de itens IPM. SchedulePlus.FreeBusy.BinaryData deve ser ignorado pelos clientes de serviços Web. Estes itens temporários são eliminados depois de serem criados. Se for efetuada uma tentativa para obter estes itens, será devolvido um erro que indica que o item não foi encontrado.

Construtores

GetEventsType()

O GetEventsType construtor inicializa uma nova instância da GetEventsType classe .

Propriedades

SubscriptionId

A SubscriptionId propriedade obtém ou define o identificador de uma subscrição. Esta propriedade é obrigatória. Esta é uma propriedade de leitura/escrita.

Watermark

A Watermark propriedade obtém ou define uma cadeia que representa um marcador de eventos na fila de eventos da caixa de correio. Esta propriedade é obrigatória. Esta é uma propriedade de leitura/escrita.

Aplica-se a