Compartir a través de


DeleteAttachmentType Class

The DeleteAttachmentType class represents a request to delete an attachment on an item in the Exchange database.

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

Syntax

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

Remarks

The DeleteAttachment operation returns the identifier and new change key of the item that held the attachment before it was deleted.

Inheritance Hierarchy

System.Object
   ExchangeWebServices.BaseRequestType
    ExchangeWebServices.DeleteAttachmentType

Example

The following code example shows a DeleteItem request that deletes two attachments.

static void DeleteAttachment(ExchangeServiceBinding esb)
{
    // Create the request.
    DeleteAttachmentTyperequest = new DeleteAttachmentType();
    
    // Identify the attachments to delete.
    RequestAttachmentIdType[] attachments = new RequestAttachmentIdType[2];
    attachments[0] = new RequestAttachmentIdType();
    attachments[1] = new RequestAttachmentIdType();
    attachments[0].Id = "AAAlAE1B";
    attachments[1].Id = "AAAlAE1B";

    request.AttachmentIds = attachments;

    try
    {
        DeleteAttachmentResponseType response = esb.DeleteAttachment(request);
        ArrayOfResponseMessagesType aormt = response.ResponseMessages;
        ResponseMessageType[] rmta = aormt.Items;

        foreach (ResponseMessageType rmt in rmta)
        {
            DeleteAttachmentResponseMessageType darmt = (rmt as DeleteAttachmentResponseMessageType);

            if (darmt.ResponseClass == ResponseClassType.Success)
            {
                Console.WriteLine("Attachment deleted from ItemId: " + darmt.RootItemId.RootItemId);    
            }
        }
    }
    catch (Exception e)
    {
        Console.WriteLine(e.Message);
    }
}

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)