Re: MAPI_E_LOGON_FAILED when running two MAPI clients as different users
- From: "Dmitry Streblechenko" <dmitry@xxxxxxxxxxx>
- Date: Thu, 31 Mar 2005 11:02:15 -0700
Exchange provider has problems with simultaneous MAPI sessions connected to
Exchange Servers in different domains.
Do both user accouns come from the same domain and connect to the same
server?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Jon Goldberg" <jong@xxxxxxxxxxxxx> wrote in message
news:uBWucbgNFHA.688@xxxxxxxxxxxxxxxxxxxxxxx
> Hi-
>
> I have a program that impersonates a domain account and connects to an
> Exchange Server mailbox. The code works great when it is the only
> MAPI client running on the machine. It also works if I have another
> MAPI client (such as Outlook) running, but only if that client is
> running under the same domain account. As soon as I run Outlook under
> a different account, or run a second instance of my own program
> running under another account, I get MAPI_E_LOGON_FAILED errors.
>
> There seems to be some problem running simultaneous MAPI client
> programs on the same machine under different accounts.
>
> Does anyone know how to have two concurrent threads use MAPI as
> different users?
>
> Here are some details on my code:
>
> First, I impersonate the domain account:
>
> 1. LogonUser as the domain account
> 2. LoadUserProfile as the newly logged-on user
> 3. GetUserProfileDirectory to verify the profile is loaded
> 4. ImpersonateLoggedOnUser to run under the new security context. I
> verify that the SECURITY_IMPERSONATION_LEVEL is
> SecurityImpersonation at this point, and that GetUserName returns
> the name of the domain account
>
> Next, I dynamically create a MAPI profile to connect to the
> mailbox owned by that account:
>
> 1. MAPIInitialize as NT_SERVICE
> 2. GetProfileTable to see if my profile already exists. If not:
> a. CreateProfile
> b. CreateMsgService to add MSEMS to the profile
> c. Query the service table to get the handle to the MSEMS service
> d. ConfigureMsgService: FAILS if Outlook or some other MAPI
> client is running as some other user. SUCCEEDS if no one
> else is running.
> 3. MAPILogonEx
> 4. GetMsgStoresTable to find the default store
> 5. OpenMsgStore: FAILS if Outlook or some other MAPI client is running
> as some other user. SUCCEEDS if no one else is running.
>
> My versions are:
> OS: Windows 2000, SP4.
> Outlook: 2002 (10.2627.3501) SP-1 installed.
> Exchange Administrator 5.5 (2650.24) client, SP 3 installed.
>
> I don't have Exchange Server installed on my development machine. I
> am connecting to a remote Exchange 5.5 machine.
>
> thanks for any help,
> Jon
.
- Follow-Ups:
- Re: MAPI_E_LOGON_FAILED when running two MAPI clients as different users
- From: Jon Goldberg
- Re: MAPI_E_LOGON_FAILED when running two MAPI clients as different users
- References:
- MAPI_E_LOGON_FAILED when running two MAPI clients as different users
- From: Jon Goldberg
- MAPI_E_LOGON_FAILED when running two MAPI clients as different users
- Prev by Date: MAPI_E_LOGON_FAILED when running two MAPI clients as different users
- Next by Date: Re: MAPI_E_LOGON_FAILED when running two MAPI clients as different users
- Previous by thread: MAPI_E_LOGON_FAILED when running two MAPI clients as different users
- Next by thread: Re: MAPI_E_LOGON_FAILED when running two MAPI clients as different users
- Index(es):
Relevant Pages
|