/// <summary> /// Delete all attachments from defect /// </summary> /// <param name="bug">TDAPIOLELib.Bug Object</param> /// <returns>True if Successfull</returns> public Boolean DeleteAllAttachments(TDAPIOLELib.Bug bug) { TDAPIOLELib.AttachmentFactory OAttachmentFactory; OAttachmentFactory = bug.Attachments; TDAPIOLELib.List AttachmentsList = OAttachmentFactory.NewList(""); foreach (TDAPIOLELib.Attachment OAttach in AttachmentsList) { OAttachmentFactory.RemoveItem(OAttach.ID); } return(true); }
/// <summary> /// Delete defect attachment by name /// </summary> /// <param name="bug">TDAPIOLELib.Bug Object</param> /// <param name="attachmentName">Name of attachment</param> /// <returns>True if successfull</returns> public Boolean DeleteAttachmentByName(TDAPIOLELib.Bug bug, String attachmentName) { TDAPIOLELib.AttachmentFactory OAttachmentFactory; OAttachmentFactory = bug.Attachments; TDAPIOLELib.List AttachmentsList = OAttachmentFactory.NewList(""); foreach (TDAPIOLELib.Attachment OAttach in AttachmentsList) { if (OAttach.Name.EndsWith(attachmentName)) { OAttachmentFactory.RemoveItem(OAttach.ID); break; } } return(true); }