UnsubscribeType Class

Definition

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

public ref class UnsubscribeType : ExchangeWebServices::BaseRequestType
public class UnsubscribeType : ExchangeWebServices.BaseRequestType
Public Class UnsubscribeType
Inherits BaseRequestType
Inheritance
UnsubscribeType

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 <span class="label">request</span> = new UnsubscribeType();
<span class="label">request</span>.SubscriptionId = "a87a6b81-cf30-4fa0-b86a-6c66ff902123";

    // Send the request and get the response.
    UnsubscribeResponseType response = esb.Unsubscribe(<span class="label">request</span>);

    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.");
        }
    }
}

Remarks

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

Constructors

UnsubscribeType()

The UnsubscribeType constructor initializes a new instance of the UnsubscribeType class.

Properties

SubscriptionId

The SubscriptionId property gets or sets the subscription identifier of a subscription to cancel. This property is required. This is a read/write property.

Applies to