UnsubscribeType Class

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

Inheritance Hierarchy

System.Object
  ExchangeWebServices.BaseRequestType
    ExchangeWebServices.UnsubscribeType

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

Syntax

'Declaration
<SerializableAttribute> _
Public Class UnsubscribeType _
    Inherits BaseRequestType
'Usage
Dim instance As UnsubscribeType
[SerializableAttribute]
public class UnsubscribeType : BaseRequestType

Remarks

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

Examples

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.");
        }
        else
        {
            Console.WriteLine("Unsubscribe failed.");
        }
    }
}

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.