I am trying to retrieve the subfolders and messages from the inbox but i was only able to retrieve the parent subfolders, also tried with PersonalNamespaces[0]
var inbox = client.Inbox;
inbox.Open (FolderAccess.ReadWrite);
Debug.WriteLine ("Total messages: {0}", inbox.Count);
//client.Inbox.Status(StatusItems.Unread);
//Debug.WriteLine("Recent messages: {0}", inbox.Unread);
//Debug.WriteLine("Recent messages: {0}", inbox.FirstUnread);
var personal = client.GetFolder(client.PersonalNamespaces[0]);
foreach (var folder in inbox.GetSubfolders(false))
{
Console.WriteLine("[folder] {0}", folder.Name);
folder.Open(FolderAccess.ReadOnly);
Not all IMAP servers will even allow subfolders of the INBOX folder. If you are sure that your IMAP account's INBOX folder has subfolders, you would use the following code snippet to get them:
foreach (var folder in client.Inbox.GetSubfolders (false)) {
Console.WriteLine ("[folder] {0}", folder.Name);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With