DeleteAttachmentType 类

定义

DeleteAttachmentType 表示删除 Exchange 数据库中某个项的附件的请求。

public ref class DeleteAttachmentType : ExchangeWebServices::BaseRequestType
public class DeleteAttachmentType : ExchangeWebServices.BaseRequestType
Public Class DeleteAttachmentType
Inherits BaseRequestType
继承
DeleteAttachmentType

示例

下面的代码示例演示删除两个附件的 DeleteItem 请求。

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

注解

DeleteAttachment作返回在删除附件之前保留的项的标识符和新的更改键。

构造函数

DeleteAttachmentType()

构造 DeleteAttachmentType 函数初始化 类的新实例 DeleteAttachmentType

属性

AttachmentIds

属性 AttachmentIds 获取或设置用于标识要删除的附件的附件标识符集。

适用于