Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect to a specific Outlook/Exchange account?

I am making an application to access a particular email account hosted on an Exchange 2003 server and do some stuff to the unread emails found. I do not really know very much about how MAPI works, so I wouldn't be too surprised if I have missed something very obvious! I am (unfortunately) using C#, I have read about the issues this may cause (and am dreading the repercussions, but my boss wants it done like this so..).

I am struggling to find any good info on how to connect to a specific account! The application will be run from someones laptop (let's say mine), so there will be a default account that Outlook connects to when opened. So:

  • Is it possible to connect to another account from a machine where the user already has there own account and probably has Outlook open?

  • If it is possible. How do I do this? When initiating the Outlook interop objects the application automatically gets the users account and sets the current user to that. I had hoped the Logon() method would sort this but no. Even just running Outlook.Application olApp = new Outlook.Application(); Goes and sets the current user to the standard account.

I hope I am making sense (probably not), but feel free to ask more detailed questions in the comments and I will reply as quickly as possible. Like I said, I know very little about MAPI and Exchange so I am struggling with how to phrase my question.

like image 825
Jammerz858 Avatar asked Jul 19 '12 13:07

Jammerz858


1 Answers

If you want to connect to a specific email account in Exchange 2003 you need to use WebDAV, CDOEX, or ExOLEDB. If you were using Exchange 2007+ you could use EWS.

Outlook Interop will only let you connect as the interactive desktop account (current logged in user). The only way to connect to other accounts is if the current interactive account has added the shared mailbox.

like image 152
SliverNinja - MSFT Avatar answered Sep 19 '22 19:09

SliverNinja - MSFT