internal static void DeleteAttachment(Item message, ExTimeZone organizerTimeZone, ExDateTime startTime, ExDateTime endTime) { bool valueOrDefault = message.GetValueOrDefault <bool>(InternalSchema.MapiHasAttachment, true); if (!valueOrDefault) { ExTraceGlobals.RecurrenceTracer.TraceDebug((long)message.GetHashCode(), "RecurrenceManager::DeleteAttachment: There are no attachments on this message"); return; } ItemAttachment itemAttachment = null; AttachmentId attachmentId = null; AttachmentId[] array; using (RecurrenceManager.InternalOpenEmbeddedMessageAndAttachment(message.AttachmentCollection, organizerTimeZone, startTime, endTime, out itemAttachment, true, out array, null)) { if (itemAttachment != null) { using (itemAttachment) { if (itemAttachment.IsCalendarException) { CalendarItem calendarItem = message as CalendarItem; if (calendarItem != null) { calendarItem.ClearExceptionSummaryList(); } } attachmentId = itemAttachment.Id; } } } if (attachmentId != null) { message.AttachmentCollection.Remove(attachmentId); foreach (AttachmentId attachmentId2 in array) { message.AttachmentCollection.Remove(attachmentId2); } return; } ExTraceGlobals.RecurrenceTracer.TraceDebug <ExDateTime, ExDateTime>((long)message.GetHashCode(), "RecurrenceManager::DeleteAttachment, Couldn't find attachment for startTime: {0} endTime: {1}", startTime, endTime); }