I use the following code to logon:
ApplicationClass outlookApplication = new ApplicationClass();
NameSpaceClass outlookNameSpace = outlookApplication.GetNamespace("MAPI") as
NameSpaceClass;
outlookNameSpace.Logon(profileName, System.Reflection.Missing.Value, false,
true);
I then look at the folders in the namespace like this:
FoldersClass foldersClass = outlookNameSpace.Folders as FoldersClass;
for (int i = 1; i <= foldersClass.Count; ++i)
{
// use foldersClass.Item(i)
}
If I have an Outlook process running, the list of folders is for that profile.
If I have no Outlook process running, the list of folders is for the Default
Profile.
ie the Logon call does nothing.
I suspect I want to be using something like....
NameSpaceClass outlookNameSpace = outlookApplication.GetNamespace("MAPI",
profileName) as NameSpaceClass;
..... but such a call doesn't exist.
So how to I get the folders from the other profile?