MAPI Session Logon error

A

AVIS

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.
 
S

Sue Mosher [MVP-Outlook]

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

Ken Slovak - [MVP - Outlook]

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
 
A

AVIS

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.
 
K

Ken Slovak - [MVP - Outlook]

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.
 
A

AVIS

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....
 
S

SvenC

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.
 
S

Sue Mosher [MVP-Outlook]

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

SvenC

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
 
A

AVIS

Hi,

I tried implementing ur suggestions, but still it is not working. I also
found that the profile name that I have selected is not prefixed to any of
the other user ids.
 
A

AVIS

Sorry, what I meant was user IDs and not profile names. Still the problem is
not getting resolved for me and i have tried all the options or help
provided, but was not able to proceed on this.
 
S

Sue Mosher [MVP-Outlook]

If you type that UserID into the To box of a message, does it resolve to an Exchange user?

Have you checked permissions on the mailbox?

--
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 said:
Sorry, what I meant was user IDs and not profile names. Still the problem is
not getting resolved for me and i have tried all the options or help
provided, but was not able to proceed on this.
 
A

AVIS

As I informed, the appointments are getting created, if the below statement
is used for the logon

Call oSession.Logon(, , True, False)

But the issue is, the current profile has to be selected from the list,
which cannot be accomodated in the application that has been developed.

As far as the resolution of the user ID, it happens correctly and gets
resolved as expected.

Proper permissions have also been given to user id.
 
A

AVIS

Any Updates?

AVIS said:
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....
 
A

AVIS

Any Updates?

AVIS said:
As I informed, the appointments are getting created, if the below statement
is used for the logon

Call oSession.Logon(, , True, False)

But the issue is, the current profile has to be selected from the list,
which cannot be accomodated in the application that has been developed.

As far as the resolution of the user ID, it happens correctly and gets
resolved as expected.

Proper permissions have also been given to user id.
 
S

Sue Mosher [MVP-Outlook]

An alternative would be to provide the name of a profile.

--
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 said:
As I informed, the appointments are getting created, if the below statement
is used for the logon

Call oSession.Logon(, , True, False)

But the issue is, the current profile has to be selected from the list,
which cannot be accomodated in the application that has been developed.

As far as the resolution of the user ID, it happens correctly and gets
resolved as expected.

Proper permissions have also been given to user id.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top