DeleteItemType Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The DeleteItemType class represents a request to delete items in an Exchange database.
public ref class DeleteItemType : ExchangeWebServices::BaseRequestType
public class DeleteItemType : ExchangeWebServices.BaseRequestType
Public Class DeleteItemType
Inherits BaseRequestType
- Inheritance
Examples
The following code example shows you how to delete two items. The deleted items are moved to the Deleted Items folder. If the item is a task, only the specified task is deleted. If the item is a meeting, a meeting cancellation is sent to all the attendees.
static void DeleteItem(ExchangeServiceBinding esb)
{
// Create the request.
DeleteItemType <span class="label">request</span> = new DeleteItemType();
// Identify the items to delete.
ItemIdType[] items = new ItemIdType[2];
items[0] = new ItemIdType();
items[0].Id = "AAAlAE1BQG1";
items[1] = new ItemIdType();
items[1].Id = "AAAlAE1BQG2";
<span class="label">request</span>.ItemIds = items;
// Identify how deleted items are handled.
<span class="label">request</span>.DeleteType = DisposalType.MoveToDeletedItems;
// Identify how tasks are deleted.
<span class="label">request</span>.AffectedTaskOccurrences = AffectedTaskOccurrencesType.SpecifiedOccurrenceOnly;
<span class="label">request</span>.AffectedTaskOccurrencesSpecified = true;
// Identify how meeting cancellations are handled.
<span class="label">request</span>.SendMeetingCancellations = CalendarItemCreateOrDeleteOperationType.SendOnlyToAll;
<span class="label">request</span>.SendMeetingCancellationsSpecified = true;
try
{
// Send the response and receive the request.
DeleteItemResponseType response = esb.DeleteItem(<span class="label">request</span>);
ArrayOfResponseMessagesType aormt = response.ResponseMessages;
ResponseMessageType[] rmta = aormt.Items;
// Check each response message.
foreach (ResponseMessageType rmt in rmta)
{
if (rmt.ResponseClass == ResponseClassType.Success)
{
Console.WriteLine("Deleted item.");
}
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
Remarks
The DeleteItemType class is used to delete items from a user's mailbox. The RemoveItem response object on a meeting cancellation notice should be used to remove canceled meetings from a user's mailbox.
The order of the items that is specified by the ItemIds property determines the order of the response messages that are returned in the response. This means that the second item that is identified to be deleted will correspond to the second response message. One response message is created for each item that is to be deleted.
Constructors
DeleteItemType() |
The DeleteItemType constructor initializes a new instance of the DeleteItemType class. |
Properties
AffectedTaskOccurrences |
The AffectedTaskOccurrences property gets or sets an enumeration value that indicates whether a task instance or task master is deleted. This property is required when tasks are deleted. This is a read/write property. |
AffectedTaskOccurrencesSpecified |
The AffectedTaskOccurrencesSpecified property gets or sets a Boolean value that specifies whether the AffectedTaskOccurrences property is serialized into the Simple Object Access Protocol (SOAP) request. This is a read/write property. |
DeleteType |
The DeleteType property gets or sets an enumeration value that describes how an item is deleted. This property is required. This is a read/write property. |
ItemIds |
The ItemIds property gets or sets the collection of items to delete. This property is required. This is a read/write property. |
SendMeetingCancellations |
The SendMeetingCancellations property gets or sets an enumeration that describes how cancellations are handled for deleted meetings. This property is required for calendar item deletions. This is a read/write property. |
SendMeetingCancellationsSpecified |
The SendMeetingCancellationsSpecified property gets or sets a Boolean value that specifies whether the SendMeetingCancellations property is serialized in the Simple Object Access Protocol (SOAP) request. This is a read/write property. |