Gmail works fine for me, it's only that exchange server that requires me to actually make two calls to get all the unseen messages and mark them seen.
on the call <messages>.Download("UNSEEN"); I see this error in the debug console. Setting IsDebug to true doesn't seem to add anything for me...
"A first chance exception of type 'System.FormatException' occurred in System.dll"
Here is the code I'm using as well:
on the call <messages>.Download("UNSEEN"); I see this error in the debug console. Setting IsDebug to true doesn't seem to add anything for me...
"A first chance exception of type 'System.FormatException' occurred in System.dll"
Here is the code I'm using as well:
public static string[] getUnreadOutlook()
{
ImapClient imap = new ImapClient(host, 143, false, true);
imap.IsDebug = true;
var result = imap.Connect();
if (!imap.Login(username, password))
{
Program.printInColor("Error logging into Exchange. ", ConsoleColor.Red);
return null;
}
var messages = imap.Folders["INBOX"].Messages;
messages.Download("UNSEEN");
List<string> subjects = new List<string>();
foreach (var mes in messages)
{
//mes.Flags.Add(ImapX.Flags.MessageFlags.Seen);
mes.Seen = true;
subjects.Add(mes.Subject);
}
return subjects.ToArray();
}
Edit: the flag I see in the messages is "\Recent". Also a side note, if I mark a message unread and run this code it works fine and marks it as seen. If I email a new message in I have to run this code twice for it to be marked as seen.