Compartilhar via


DeleteAttachmentType Classe

Definição

A DeleteAttachmentType classe representa uma solicitação para excluir um anexo em um item no banco de dados do Exchange.

public ref class DeleteAttachmentType : ExchangeWebServices::BaseRequestType
public class DeleteAttachmentType : ExchangeWebServices.BaseRequestType
Public Class DeleteAttachmentType
Inherits BaseRequestType
Herança
DeleteAttachmentType

Exemplos

O exemplo de código a seguir mostra uma solicitação DeleteItem que exclui dois anexos.

static void DeleteAttachment(ExchangeServiceBinding esb)
{
    // Create the request.
<span class="label">DeleteAttachmentType</span><span class="label">request</span> = 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";

<span class="label">request</span>.AttachmentIds = attachments;

    try
    {
        DeleteAttachmentResponseType response = esb.DeleteAttachment(<span class="label">request</span>);
        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);
    }
}

Comentários

A operação DeleteAttachment retorna o identificador e a nova chave de alteração do item que mantinha o anexo antes de ser excluído.

Construtores

DeleteAttachmentType()

O DeleteAttachmentType construtor inicializa uma nova instância da DeleteAttachmentType classe.

Propriedades

AttachmentIds

A AttachmentIds propriedade obtém ou define o conjunto de identificadores de anexo que são usados para identificar os anexos a serem excluídos.

Aplica-se a