This project is read-only.

Examine query

Topics: Feature Requests
Jan 30, 2014 at 3:22 PM
To follow on from the short discussion (#479026) where Darren answered his own question on STATUS by suggesting use of folder.Examine() followed by the folder.Recent and folder.Exists to probably give him what he wanted. I too am trying to get some basic information on each folder without grabbing all of the message data.

I have tried the following code:
var client = new ImapClient("my.imap.server.com", true);

if (client.Login("username", "pswd"))
{
   foreach (Folder folder in client.Folders)
   {
       folder.Examine();
       Console.WriteLine(folder.Name + "  Exists:" + folder.Exists.ToString() + ";  Unseen:" + folder.Unseen.ToString());
   }
}
...
which always shows correctly the number of messages existing in each folder, but always returns zero as the number of messages in each folder which are UNSEEN. This outcome occurs even though there are definitely UNSEEN messages in some folders.

Is this the right way of using Examine()?

Many thanks, JanEric
Jan 30, 2014 at 10:46 PM
Hi JanEric,

can you give more details on your environment? Which server are you using?

Greets,

Pavel
Jan 31, 2014 at 1:02 AM
Hi Pavel,

Thanks for your message. My server is imap.yandex.com and my imap client is using VS2010 on a Win7 box. Please let me know any other environment details you might want.

Regards, JanEric
Jan 31, 2014 at 9:37 AM
Hi JanEric,

i have a messge box on yandex, will make some tests today and let you know. Also feel free to contact me in russian.

best regards,

Pavel
Feb 12, 2014 at 3:43 PM
Edited Feb 12, 2014 at 4:06 PM
Hi JanEric,

In the current version of the library, the Folder.Unseen property gives you the message sequence number of the first unseen message in the mailbox, and not the amount of unseen messages.

I now implemented the STATUS command, and made a few changes:
  • Folder.FirstUnseen gives you the message sequence number of the first unseen message
  • Folder.Unseen gives you the number of unseen messages in the folder. (Needs a call to Folder.Status method first)
You can call the Folder.Status method this way:
folder.Status(new[] { FolderStatusFields.Unseen });
Greets,

Pavel
Feb 25, 2014 at 1:25 AM
Hi Pavel,

Many thanks for your reply and for your ongoing work on the STATUS command. How do I access the results of the work you have done so far on this?

Regards, JanEric