Re: MAPI_E_LOGON_FAILED when running two MAPI clients as different users



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


.



Relevant Pages

  • Re: Delay Delivery with multiple accounts
    ... Name: Microsoft Exchange Server - Type: Exchange ... Name: ShoreWare Voicemail - Type: MAPI ... The voicemail account integrates my outlook contact list with my phone system ...
    (microsoft.public.exchange.admin)
  • ASP.NET Security problem trying to access MAPI
    ... Because of limitation of our Exchange Server here in the office, ... I am using MAPI, via a MAPI .NET wrapper called MAPI33. ... i.e. my email account. ... Domain User, i.e. myself, hence when I tried to log-on to the email ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: SQL Mail doesnt work. Please HELP!
    ... You have to set the sql services to run under an account other then "system" ... One thing to note mapi does not work well on systems with more ... the profile seems to randomly have strange behavior. ...
    (microsoft.public.sqlserver.security)
  • Re: "Choose Profile"
    ... Please don't apologize for any confusion -- I'm probably the one who should ... No problem with changing the default mail handler. ... So all that is in the context of your E-mail account. ... >>> regarding OE and profiles when using MAPI. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Will anybody help me now?
    ... Exactly where do I configure this MAPI. ... Subject 'Test', Account: ... > MVP for Exchange Server ... >> I created two users in that domain one named Nik and the other test. ...
    (microsoft.public.exchange.admin)