I created a Windows Form Application that uses the Outlook 2016 COMObject.
But, I am receiving the following error, when trying to get the default folder.
System.Runtime.InteropServices.COMException (0x80004005): The operation failed.
at Microsoft.Office.Interop.Outlook.NameSpaceClass.GetDefaultFolder(OlDefaultFolders FolderType)
The code breaks in this part.
oApp = new Outlook.Application();
oNS = oApp.GetNamespace("mapi");
oNS.Logon(inbox, password, true, true);
oInbox = oNS.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderSentMail);
Any hint or idea about what is causing this error?
Thanks in advance!
Namespace.Logon
takes the name of an existing profile (as shown by Control Panel | Mai l| Show Profiles) or an empty string (to use the default profile). The password parameter is not used.
User contributions licensed under CC BY-SA 3.0