Hello,
I’m getting Error: “AE0004 BAD Command received in Invalid” on imapClient.DeleteMessage()
Here is my code:
//Pass only the name of the license file embedded in the assembly
license.SetLicense(“Aspose.Total.lic”);
_log.Debug(“Connecting to Exchange Server 2007 using IMAP”);
ImapClient imapClient = new ImapClient(Properties.Settings.Default.Exchange_Host, Properties.Settings.Default.Exchange_Port, Properties.Settings.Default.Exchange_Username, Properties.Settings.Default.Exchange_Password);
imapClient.SecurityOptions = SecurityOptions.None;
ImapQueryBuilder builder = new ImapQueryBuilder();
builder.Subject.Contains(“Test”);
ImapMessageInfoCollection msgCollection = imapClient.ListMessages(query);
MailQuery query = builder.GetQuery();
ImapMessageInfoCollection msgCollection = imapClient.ListMessages(query);
foreach (ImapMessageInfo msgInfo in msgCollection)
{ {
imapClient.DeleteMessage(msgInfo.UniqueId);
}
I’ve been struggling on this for awhile now… Any help will be greatly appreciated.
Update: Just figured it out
I forgot:
imapClient.SelectFolder(ImapFolderInfo.InBox);