M
michel.kowalczyk
Hi,
Coudn't figure this by my own
How to print to the console all outlook folders and mail subjects. I
was able to write a piece of code that prints the names of the main
folders but I don't know how to print subfolders and mails subjects.
Anyone ?? help.
My outlook foldertree looks like that:
Personal Files
Drafts
Inbox
Junk E-mail
Outbox
Sent Items
Some Folder
Nested Folder
Search Folders
Folders 2
Deleted Items
Hello
Search Folders
My code:
using Outlook = Microsoft.Office.Interop.Outlook;
Outlook.Application oApp = new Outlook.Application();
Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
oNS.Logon(Missing.Value, Missing.Value, false, true);
Outlook.MAPIFolder oIFolder = oNS.Folders.GetFirst();
Console.WriteLine(oIFolder.Name);
int nFolderCount = oNS.Folders.Count;
for (int p=1; p < nFolderCount; p++)
{
oIFolder = oNS.Folders.GetNext();
Console.WriteLine(oIFolder.Name);
}
TIA
Michal
p.s.
I use Outlook 2003
Microsoft Visual C# 2005 Express Edition
Microsoft XP Pro
Coudn't figure this by my own
How to print to the console all outlook folders and mail subjects. I
was able to write a piece of code that prints the names of the main
folders but I don't know how to print subfolders and mails subjects.
Anyone ?? help.
My outlook foldertree looks like that:
Personal Files
Drafts
Inbox
Junk E-mail
Outbox
Sent Items
Some Folder
Nested Folder
Search Folders
Folders 2
Deleted Items
Hello
Search Folders
My code:
using Outlook = Microsoft.Office.Interop.Outlook;
Outlook.Application oApp = new Outlook.Application();
Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
oNS.Logon(Missing.Value, Missing.Value, false, true);
Outlook.MAPIFolder oIFolder = oNS.Folders.GetFirst();
Console.WriteLine(oIFolder.Name);
int nFolderCount = oNS.Folders.Count;
for (int p=1; p < nFolderCount; p++)
{
oIFolder = oNS.Folders.GetNext();
Console.WriteLine(oIFolder.Name);
}
TIA
Michal
p.s.
I use Outlook 2003
Microsoft Visual C# 2005 Express Edition
Microsoft XP Pro