UnsubscribeType Class

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

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

Syntax

'Declaration
<SerializableAttribute> _
<GeneratedCodeAttribute("wsdl", "2.0.50727.42")> _
<XmlTypeAttribute(Namespace:="http://schemas.microsoft.com/exchange/services/2006/messages")> _
<DesignerCategoryAttribute("code")> _
<DebuggerStepThroughAttribute> _
Public Class UnsubscribeType
    Inherits BaseRequestType
[SerializableAttribute] 
[GeneratedCodeAttribute("wsdl", "2.0.50727.42")] 
[XmlTypeAttribute(Namespace="http://schemas.microsoft.com/exchange/services/2006/messages")] 
[DesignerCategoryAttribute("code")] 
[DebuggerStepThroughAttribute] 
public class UnsubscribeType : BaseRequestType
[SerializableAttribute] 
[GeneratedCodeAttribute(L"wsdl", L"2.0.50727.42")] 
[XmlTypeAttribute(Namespace=L"http://schemas.microsoft.com/exchange/services/2006/messages")] 
[DesignerCategoryAttribute(L"code")] 
[DebuggerStepThroughAttribute] 
public ref class UnsubscribeType : public BaseRequestType
/** @attribute SerializableAttribute() */ 
/** @attribute GeneratedCodeAttribute("wsdl", "2.0.50727.42") */ 
/** @attribute XmlTypeAttribute(Namespace="http://schemas.microsoft.com/exchange/services/2006/messages") */ 
/** @attribute DesignerCategoryAttribute("code") */ 
/** @attribute DebuggerStepThroughAttribute() */ 
public class UnsubscribeType extends BaseRequestType
SerializableAttribute 
GeneratedCodeAttribute("wsdl", "2.0.50727.42") 
XmlTypeAttribute(Namespace="http://schemas.microsoft.com/exchange/services/2006/messages") 
DesignerCategoryAttribute("code") 
DebuggerStepThroughAttribute 
public class UnsubscribeType extends BaseRequestType

Remarks

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

Inheritance Hierarchy

System.Object
   ExchangeWebServices.BaseRequestType
    ExchangeWebServices.UnsubscribeType

Example

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.

Platforms

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003,

Target Platforms

Windows 98, Windows 2000, Windows 2000 Server, Windows CE, Windows Longhorn, Windows 98 Second Edition, Pocket PC, Smart Phone, Windows Server 2003, Windows XP Professional with Service Pack 2 (SP2)