Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / April 2008

Tip: Looking for answers? Try searching our database.

MAPI Session Logon error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AVIS - 17 Apr 2008 11:49 GMT
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] - 17 Apr 2008 14:00 GMT
Did you actually install CDO 1.21 on the Outlook 2007 system? It is a separate download.

Signature

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

> Hi All,
>
[quoted text clipped - 18 lines]
> is having the problem and the others (I hope all are using WINDOWS XP, with
> OUTLOOK 2003) are not having the problem.
AVIS - 18 Apr 2008 05:41 GMT
Yupe, I have got CDO 1.21 installed.  But still it is not working.

> Did you actually install CDO 1.21 on the Outlook 2007 system? It is a separate download.
>
[quoted text clipped - 20 lines]
> > 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] - 17 Apr 2008 14:19 GMT
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

Signature

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

> Hi All,
>
[quoted text clipped - 22 lines]
> with
> OUTLOOK 2003) are not having the problem.
AVIS - 18 Apr 2008 05:47 GMT
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.

> So the Session instantiates when using ShowDialog? Does the user enter their
> normal logon in that dialog?
[quoted text clipped - 33 lines]
> > with
> > OUTLOOK 2003) are not having the problem.
Ken Slovak - [MVP - Outlook] - 18 Apr 2008 14:05 GMT
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.

Signature

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

> 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 - 21 Apr 2008 09:07 GMT
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....

> 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
[quoted text clipped - 8 lines]
> > The server details are from the database and the same details are used by
> > other users, where the program is working fine.
AVIS - 29 Apr 2008 08:39 GMT
Any Updates?

> 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
[quoted text clipped - 14 lines]
> > > The server details are from the database and the same details are used by
> > > other users, where the program is working fine.
SvenC - 21 Apr 2008 10:04 GMT
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] - 21 Apr 2008 15:13 GMT
Actually, it should be possible to do that by prefixing the userID with "=" to force an exact match, e.g. "=" & UserId

Signature

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

> Hi AVIS,
>
[quoted text clipped - 22 lines]
> --
> SvenC
SvenC - 21 Apr 2008 15:52 GMT
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
AVIS - 22 Apr 2008 08:41 GMT
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.

> Hi Sue,
>
[quoted text clipped - 7 lines]
> --
> SvenC
Sue Mosher [MVP-Outlook] - 22 Apr 2008 13:58 GMT
Profile names and user IDs are two completely different things.

Signature

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

> Hi,
>
[quoted text clipped - 13 lines]
>> --
>> SvenC
AVIS - 24 Apr 2008 10:46 GMT
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.

> Profile names and user IDs are two completely different things.
>
[quoted text clipped - 15 lines]
> >> --
> >> SvenC
Sue Mosher [MVP-Outlook] - 24 Apr 2008 13:23 GMT
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?

Signature

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

> 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
[quoted text clipped - 19 lines]
>> >> --
>> >> SvenC
AVIS - 25 Apr 2008 07:16 GMT
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.

> If you type that UserID into the To box of a message, does it resolve to an Exchange user?
>
[quoted text clipped - 23 lines]
> >> >> --
> >> >> SvenC
AVIS - 29 Apr 2008 08:39 GMT
Any Updates?

> As I informed, the appointments are getting created, if the below statement
> is used for the logon
[quoted text clipped - 36 lines]
> > >> >> --
> > >> >> SvenC
Sue Mosher [MVP-Outlook] - 29 Apr 2008 13:12 GMT
An alternative would be to provide the name of a profile.

Signature

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

> As I informed, the appointments are getting created, if the below statement
> is used for the logon
[quoted text clipped - 12 lines]
>>
>> Have you checked permissions on the mailbox?

>> > 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
[quoted text clipped - 19 lines]
>> >> >> --
>> >> >> SvenC
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.