We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error: "AE0004 BAD Command received in Invalid" on imapClient.DeleteMessage()

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

Hi Jason,

Thank you for posting your inquiry.

We have tested this issue at our end with ExchangeClient of the API and were not able to reproduce the issue. Can you please arrange a test account on your server and share its credentials with us? We shall check it at our end and assist you further.