MAPILogonEx without interactive user

MAPILogonEx without interactive user

Post by Bengt Rosenberge » Thu, 20 Mar 2003 00:14:08



Hi,

I have another question:

I'm trying to send mails from a COM+ DLL.
I created a COM+ package in MTS and installed the DLLs in there.

Everything works fine while the package runs under the interactive user.

But this is not a viable option for me, I have to set the identity to a
special domain account.
When I do this, MAPILogonEx fails.

How can I make it work with 'this user'?

Thank you!

P.S.: we use exchange server 2000 with latest service pack

 
 
 

MAPILogonEx without interactive user

Post by Ronny On » Thu, 20 Mar 2003 12:11:06


MAPILogonEx requires that a MAPI profile exist within the Windows user
profile of the account you're running under. Even if you're using the
default MAPI profile in your MAPILogonEx call, it doesn't exist if you've
never created it while logged on as your "special" domain user. You can
either log onto the machine using that account and create the MAPI profile
manually, or you can use the IProfAdmin interface to do it from your code. I
suggest logging on manually, at least to verify that your "special" account
has the Windows "Log On Locally" right. If it doesn't, your IProfAdmin calls
will fail anyway.


Quote:> Hi,

> I have another question:

> I'm trying to send mails from a COM+ DLL.
> I created a COM+ package in MTS and installed the DLLs in there.

> Everything works fine while the package runs under the interactive user.

> But this is not a viable option for me, I have to set the identity to a
> special domain account.
> When I do this, MAPILogonEx fails.

> How can I make it work with 'this user'?

> Thank you!

> P.S.: we use exchange server 2000 with latest service pack


 
 
 

MAPILogonEx without interactive user

Post by Bengt Rosenberge » Thu, 20 Mar 2003 18:45:55


Thanks for the answer.

But I doubt that this is the problem, because for testing purposes I logged
onto the server with my
developer domain account and created a profile with Profman2.exe, then I set
the identity
of the package to the same account.

MAPILogonEx still fails with E_MAPI_LOGON_FAILED.

However if I log onto the server with this account and set the package to
"interactive user" and
stay logged on, everything works fine as long as I don't log off.



> MAPILogonEx requires that a MAPI profile exist within the Windows user
> profile of the account you're running under. Even if you're using the
> default MAPI profile in your MAPILogonEx call, it doesn't exist if you've
> never created it while logged on as your "special" domain user. You can
> either log onto the machine using that account and create the MAPI profile
> manually, or you can use the IProfAdmin interface to do it from your code.
I
> suggest logging on manually, at least to verify that your "special"
account
> has the Windows "Log On Locally" right. If it doesn't, your IProfAdmin
calls
> will fail anyway.



> > Hi,

> > I have another question:

> > I'm trying to send mails from a COM+ DLL.
> > I created a COM+ package in MTS and installed the DLLs in there.

> > Everything works fine while the package runs under the interactive user.

> > But this is not a viable option for me, I have to set the identity to a
> > special domain account.
> > When I do this, MAPILogonEx fails.

> > How can I make it work with 'this user'?

> > Thank you!

> > P.S.: we use exchange server 2000 with latest service pack

 
 
 

MAPILogonEx without interactive user

Post by Daniel Mitchell [MVP » Fri, 21 Mar 2003 03:45:34




Quote:> However if I log onto the server with this account and set the package
> to "interactive user" and
> stay logged on, everything works fine as long as I don't log off.

 That's because interactive users see the registry differently to
services/packages/etc, so the profile you created when logged in isn't
there for the app.

 Use the code from KB Q170225 to create a profile from within your app,
then it's guaranteed to be in the right registry hive. Also, see KB Q259301
for other things that you might hit; it talks about services, but I'm
guessing that COM+ may have the same sort of issues.

 -- dan

 
 
 

1. MAPILogonEx and NT Service

Hi All,

My task is to log on to MAPI within NT service and still be able to send/receive mail using non Microsoft Exchange Server transports (like Internet Mail, MS Mail & so on)

1. My MAPI application is written as a NT service. I work with NT 4.0 SP4, Exchange Server 5.5 and Outlook 98.

I have no problems when it's running as application (not as service).

2. When I logon to MAPI with Exchange Server Transport installed, it is OK.

3. When I logon to MAPI from service when Outlook 98 is running, it is OK too (user is logged on and Outloook is running - i.e. MAPI spooler is running too).

4. When I am trying to logon to MAPI from service without Exchange Server transport installed in profile - the service hangs in MAPILogonEx function and MAPI spooler doesn't run. I don't add to dwFlag MAPI_NO_MAIL because I want send and receive any messages.

My version of Mapi32.dll is 5.5.2174.0.

I have read all related articles from MAPI developers forum and didn't find an answer that help me solve my problem.

Any help is greatly appreciated,

Ilia

VariCom Technologies Ltd.


My code is following:

ULONG dwFlag = 0;

if ( m_bService )

{

dwFlag = MAPI_NT_SERVICE;

dwFlag |= MAPI_MULTITHREAD_NOTIFICATIONS;

MAPIINIT_0 MAPIINIT= { 0, dwFlag};

if( MAPIInitialize ( &MAPIINIT) )

{

return;

String Profile = theApp . GetProfileName ();

if( Profile . IsEmpty () )

{

if( ! GetDefaultProfileName ( Profile ) )

{

return -1;

lstrcpy ( theApp . GetProfileName (), Profile ) ;

dwFlag = MAPI_EXTENDED | MAPI_LOGON_UI | MAPI_EXPLICIT_PROFILE | MAPI_NEW_SESSION;

if ( m_bService )

{

dwFlag = MAPI_NT_SERVICE | MAPI_USE_DEFAULT | MAPI_NEW_SESSION | MAPI_EXTENDED;

if( MAPILogonEx(NULL, theApp . GetProfileName (),NULL,dwFlag,& pMapiSession) != S_OK)

{

return -1;

2. urgent: outgoing email probs

3. listing and possibly reading a users mail without logging on as the user

4. OWA Configuration

5. delete user mailbox without deleting user account

6. Exchange2000 restore does not start

7. Interactive script agent, how?

8. pop 3 connection from MS internet mail client

9. Build interactive toons online 2646

10. EAA Interactive error #430

11. Exchange Archiving Agent Interactive Client

12. Interactive Profiles

13. HELP: How to MAPILogonEx to a specific profile without UI to HrOpenExchangePrivateStore from a remote Exchange 2000 Server?