Hello,
I am trying to access an outlook account and process all the present emails on some Inbox's subfolder:
I can access to this user's inbox, but not the subfolder.
static void ReadMail()
{
Outlook.Application oApp = new Outlook.Application();
Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
oNS.Logon(Missing.Value,Missing.Value,false,true);
Outlook.Recipient myRecipient = oNS.CreateRecipient("USERSMAILBOX");
myRecipient.Resolve();
Outlook.MAPIFolder oInbox = oNS.GetSharedDefaultFolder(myRecipient, Outlook.OlDefaultFolders.olFolderInbox);
Outlook.Items oItems = oInbox.Items;
Outlook.MailItem oMsg = (Outlook.MailItem)oItems.GetFirst();
MessageBox.Show(oMsg.Subject);
oNS.Logoff();
oMsg = null;
oItems = null;
oInbox = null;
oNS = null;
oApp = null;
}
Right now I am able to printout the mails inside this user's inbox, but how can I fetch the mails inside a subfolder, named for example subFolder?
BR,
pgb