UnsubscribeType class

The UnsubscribeType class represents a request to end a pull notification subscription.


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

public class UnsubscribeType : BaseRequestType

We recommend that you intentionally end a subscription instead of letting a subscription time out.

The following example shows you how to end a single subscription.

static void Unsubscribe(ExchangeServiceBinding esb)
    // Create the request by using a subscription ID.
    UnsubscribeType request = new UnsubscribeType();
    request.SubscriptionId = "a87a6b81-cf30-4fa0-b86a-6c66ff902123";

    // Send the request and get the response.
    UnsubscribeResponseType response = esb.Unsubscribe(request);

    ArrayOfResponseMessagesType aormt = response.ResponseMessages;
    ResponseMessageType[] rmta = aormt.Items;

    foreach (ResponseMessageType rmt in rmta)
        if (rmt.ResponseClass == ResponseClassType.Success)
            Console.WriteLine("Subscription ended successfully.");
            Console.WriteLine("Unsubscribe failed.");

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