c# - Using MAPI to access the Exchange Server from a Service -
i tasked building application check email using mapi. made utilize of wrapper class coded in cpp, accessed c#. realize combining managed , unmanaged code not best path, work.
after getting working, asked create application service, run when scheme not logged in.
the client requires utilize mapi, , using outlook 2007, compatible both x86 , x64 architecture. separate programme running on several workstations allowed send mail service using single email address. service monitor account, watching new email exchange saying message not delivered. when happens, create note in database future correction.
my understanding of how extended mapi works uses profile of person logged in access exchange server. question whether exchange server can accessed through mapi when nobody logged system? if not possible, oom allow access specific email business relationship (or profile) when no user logged in? 1 method improve other when predominantly using c#?
below brief sample of how wrapper class logs in. added sec method, never did log in profile other of current user's.
bool cmapiex::login(lpctstr szprofilename, bool binitasservice) { dword dwflags=mapi_extended | mapi_use_default | mapi_new_session; if(binitasservice) dwflags|=mapi_explicit_profile | mapi_nt_service; homecoming (mapilogonex(null, (lptstr)szprofilename, null, dwflags, &m_psession)==s_ok); } bool cmapiex::login(lpctstr szprofilename, lpctstr szprofilepassword, bool binitasservice) { dword dwflags=mapi_extended | mapi_explicit_profile | mapi_new_session; if(binitasservice) dwflags|= mapi_nt_service; homecoming (mapilogonex(null, (lptstr)szprofilename, (lptstr)szprofilepassword, dwflags, &m_psession)==s_ok); }
thank suggestions.
you can dynamically create temporary profile msems service , configure it. see http://support.microsoft.com/kb/306962?wa=wsignin1.0 , scroll "use mapi iprofadmin interface" create sure service runs under identity of mailbox owner.
c# exchange-server mapi outlook-object-model
No comments:
Post a Comment