Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   MAPI Session Logon error (http://www.outlookbanter.com/outlook-vba/70460-mapi-session-logon-error.html)

AVIS April 17th 08 11:49 AM

MAPI Session Logon error
 
Hi All,

I have a Visual Basic application which has the below code

Set Session = New MAPI.Session
ProfileInfo = ExchangeServer & vbLf & UserId
Call Session.Logon(, , False, , , , sProfileInfo)
Set Contacts = Session.GetDefaultFolder(CdoDefaultFolderContacts)

It is working fine in my PC with WINDOWS XP Professional and OUTLOOK 2003.

But the "Set oContacts = ..", given in the above coding snapshot returns an
error message, in one of the user's PC. The error is happening in a system
with WINDOWS 2003 and OUTLOOK 2007. When I replace the statement "Call
oSession.Logon(, , False, , , , sProfileInfo)" with the statement as
Call oSession.Logon(, , True, False), it is working fine

Can anyone tell me, why this is happening, is it some envvironment issue?

I cant change the code in the application, since this is the only user, who
is having the problem and the others (I hope all are using WINDOWS XP, with
OUTLOOK 2003) are not having the problem.

Sue Mosher [MVP-Outlook] April 17th 08 02:00 PM

MAPI Session Logon error
 
Did you actually install CDO 1.21 on the Outlook 2007 system? It is a separate download.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"AVIS" wrote in message ...
Hi All,

I have a Visual Basic application which has the below code

Set Session = New MAPI.Session
ProfileInfo = ExchangeServer & vbLf & UserId
Call Session.Logon(, , False, , , , sProfileInfo)
Set Contacts = Session.GetDefaultFolder(CdoDefaultFolderContacts)

It is working fine in my PC with WINDOWS XP Professional and OUTLOOK 2003.

But the "Set oContacts = ..", given in the above coding snapshot returns an
error message, in one of the user's PC. The error is happening in a system
with WINDOWS 2003 and OUTLOOK 2007. When I replace the statement "Call
oSession.Logon(, , False, , , , sProfileInfo)" with the statement as
Call oSession.Logon(, , True, False), it is working fine

Can anyone tell me, why this is happening, is it some envvironment issue?

I cant change the code in the application, since this is the only user, who
is having the problem and the others (I hope all are using WINDOWS XP, with
OUTLOOK 2003) are not having the problem.


Ken Slovak - [MVP - Outlook] April 17th 08 02:19 PM

MAPI Session Logon error
 
So the Session instantiates when using ShowDialog? Does the user enter their
normal logon in that dialog?

Do the parameters for the dynamic logon look valid on the problem machine?
How are you deriving ExchangeServer and UserId?

In general, when using a dynamic logon (where UserId must match the existing
mailbox name) you'd use something like this:

Session.Logon "", "", False, True, 0, False, sProfileInfo


--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"AVIS" wrote in message
...
Hi All,

I have a Visual Basic application which has the below code

Set Session = New MAPI.Session
ProfileInfo = ExchangeServer & vbLf & UserId
Call Session.Logon(, , False, , , , sProfileInfo)
Set Contacts = Session.GetDefaultFolder(CdoDefaultFolderContacts)

It is working fine in my PC with WINDOWS XP Professional and OUTLOOK 2003.

But the "Set oContacts = ..", given in the above coding snapshot returns
an
error message, in one of the user's PC. The error is happening in a
system
with WINDOWS 2003 and OUTLOOK 2007. When I replace the statement "Call
oSession.Logon(, , False, , , , sProfileInfo)" with the statement as
Call oSession.Logon(, , True, False), it is working fine

Can anyone tell me, why this is happening, is it some envvironment issue?

I cant change the code in the application, since this is the only user,
who
is having the problem and the others (I hope all are using WINDOWS XP,
with
OUTLOOK 2003) are not having the problem.



AVIS April 18th 08 05:41 AM

MAPI Session Logon error
 
Yupe, I have got CDO 1.21 installed. But still it is not working.

"Sue Mosher [MVP-Outlook]" wrote:

Did you actually install CDO 1.21 on the Outlook 2007 system? It is a separate download.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"AVIS" wrote in message ...
Hi All,

I have a Visual Basic application which has the below code

Set Session = New MAPI.Session
ProfileInfo = ExchangeServer & vbLf & UserId
Call Session.Logon(, , False, , , , sProfileInfo)
Set Contacts = Session.GetDefaultFolder(CdoDefaultFolderContacts)

It is working fine in my PC with WINDOWS XP Professional and OUTLOOK 2003.

But the "Set oContacts = ..", given in the above coding snapshot returns an
error message, in one of the user's PC. The error is happening in a system
with WINDOWS 2003 and OUTLOOK 2007. When I replace the statement "Call
oSession.Logon(, , False, , , , sProfileInfo)" with the statement as
Call oSession.Logon(, , True, False), it is working fine

Can anyone tell me, why this is happening, is it some envvironment issue?

I cant change the code in the application, since this is the only user, who
is having the problem and the others (I hope all are using WINDOWS XP, with
OUTLOOK 2003) are not having the problem.



AVIS April 18th 08 05:47 AM

MAPI Session Logon error
 
For the first question, No, the user specifies the admin details of the
exchange server

The server details are from the database and the same details are used by
other users, where the program is working fine.

"Ken Slovak - [MVP - Outlook]" wrote:

So the Session instantiates when using ShowDialog? Does the user enter their
normal logon in that dialog?

Do the parameters for the dynamic logon look valid on the problem machine?
How are you deriving ExchangeServer and UserId?

In general, when using a dynamic logon (where UserId must match the existing
mailbox name) you'd use something like this:

Session.Logon "", "", False, True, 0, False, sProfileInfo


--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"AVIS" wrote in message
...
Hi All,

I have a Visual Basic application which has the below code

Set Session = New MAPI.Session
ProfileInfo = ExchangeServer & vbLf & UserId
Call Session.Logon(, , False, , , , sProfileInfo)
Set Contacts = Session.GetDefaultFolder(CdoDefaultFolderContacts)

It is working fine in my PC with WINDOWS XP Professional and OUTLOOK 2003.

But the "Set oContacts = ..", given in the above coding snapshot returns
an
error message, in one of the user's PC. The error is happening in a
system
with WINDOWS 2003 and OUTLOOK 2007. When I replace the statement "Call
oSession.Logon(, , False, , , , sProfileInfo)" with the statement as
Call oSession.Logon(, , True, False), it is working fine

Can anyone tell me, why this is happening, is it some envvironment issue?

I cant change the code in the application, since this is the only user,
who
is having the problem and the others (I hope all are using WINDOWS XP,
with
OUTLOOK 2003) are not having the problem.




Ken Slovak - [MVP - Outlook] April 18th 08 02:05 PM

MAPI Session Logon error
 
Does that user have the same permissions as other users? Are you sure that
the user is using the correct alias and that they have permissions for that
alias? Did you try the suggestion I made about changing the logon arguments?

With a CDO logon it's a matter of permissions and getting your parameters
correct.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"AVIS" wrote in message
...
For the first question, No, the user specifies the admin details of the
exchange server

The server details are from the database and the same details are used by
other users, where the program is working fine.



AVIS April 21st 08 09:07 AM

MAPI Session Logon error
 
I dont think, there is anything related to the permission of the user.
Because, if i set the code, in such a way that the profile name is
selectable, then the code works fine, or else it doesnt. This happens only
in this system. All other system, the profile name is not selectable, but
the code works fine....

"Ken Slovak - [MVP - Outlook]" wrote:

Does that user have the same permissions as other users? Are you sure that
the user is using the correct alias and that they have permissions for that
alias? Did you try the suggestion I made about changing the logon arguments?

With a CDO logon it's a matter of permissions and getting your parameters
correct.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"AVIS" wrote in message
...
For the first question, No, the user specifies the admin details of the
exchange server

The server details are from the database and the same details are used by
other users, where the program is working fine.




SvenC[_2_] April 21st 08 10:04 AM

MAPI Session Logon error
 
Hi AVIS,

Set Session = New MAPI.Session
ProfileInfo = ExchangeServer & vbLf & UserId


If you have two userIds where one is the prefix of another
you cannot log on to the short userID with a dynamic
profile, because the two userIDs are counted as valid and none
is chosen automatically.

So if you have something like

"user" and "userA" you will not be able to log on with user
with a dynamic profile.

This got more complex with Exchange = 2000 because several
AD properties of a user are looked up. So the mailbox alias is only
one attribute to look at. We had problems with the windows logon
name as well.

So please verify if the problematic system is really the system or
if you just use a userID which is a prefix of another mailbox alias
or user name.

--
SvenC

Sue Mosher [MVP-Outlook] April 21st 08 03:13 PM

MAPI Session Logon error
 
Actually, it should be possible to do that by prefixing the userID with "=" to force an exact match, e.g. "=" & UserId

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"SvenC" wrote in message ...
Hi AVIS,

Set Session = New MAPI.Session
ProfileInfo = ExchangeServer & vbLf & UserId


If you have two userIds where one is the prefix of another
you cannot log on to the short userID with a dynamic
profile, because the two userIDs are counted as valid and none
is chosen automatically.

So if you have something like

"user" and "userA" you will not be able to log on with user
with a dynamic profile.

This got more complex with Exchange = 2000 because several
AD properties of a user are looked up. So the mailbox alias is only
one attribute to look at. We had problems with the windows logon
name as well.

So please verify if the problematic system is really the system or
if you just use a userID which is a prefix of another mailbox alias
or user name.

--
SvenC


SvenC[_2_] April 21st 08 03:52 PM

MAPI Session Logon error
 
Hi Sue,

Actually, it should be possible to do that by prefixing the userID
with "=" to force an exact match, e.g. "=" & UserId


I tested that a while ago and had problems with it. It could be
different behaviour for Exchange Server MAPI and Outlook MAPI.
IIRC it did not work for Exchange MAPI and ExchangeMAPICDO

--
SvenC


All times are GMT +1. The time now is 03:37 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com