Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   how to get Exchange server? (http://www.outlookbanter.com/outlook-vba/7239-how-get-exchange-server.html)

[email protected] January 13th 06 07:07 PM

how to get Exchange server?
 
Can someone post the code (in it's entirety) to determine the Exchange
server that the current logged on user belongs on?

I've tried all the CDO code snippets on the web (which are all the
same), but whenever I run it I always get the same error:

[Collaboration Data Objects - [E_INVALIDARG(80070057)]]

I'm running this on Outlook 2003 (yes I have CDO installed) from an
Outlook form. Our backend is Exchange 2003 SP1.

The actual code it always chokes on is:

strHomeServer =
objSession.GetAddressEntry(strUserID).Fields(PR_EM S_AB_HOME_MTA)

Yes, I've also tried adding in the hex code directly (&H8007001E).

Yes, I did the session logon first. Although when I first ran it just
using the code snippet I found it worked! And the code never defined
what objSession was. Since then I did some changes and now I can't get
it to work.

I just don't get it.


Dmitry Streblechenko January 15th 06 11:36 PM

how to get Exchange server?
 
Please show more of our code. How do you create objSession? How do you log
to MAPI? Where does strUserID come from? Did you remember to define
PR_EMS_AB_HOME_MTA?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

wrote in message
ups.com...
Can someone post the code (in it's entirety) to determine the Exchange
server that the current logged on user belongs on?

I've tried all the CDO code snippets on the web (which are all the
same), but whenever I run it I always get the same error:

[Collaboration Data Objects - [E_INVALIDARG(80070057)]]

I'm running this on Outlook 2003 (yes I have CDO installed) from an
Outlook form. Our backend is Exchange 2003 SP1.

The actual code it always chokes on is:

strHomeServer =
objSession.GetAddressEntry(strUserID).Fields(PR_EM S_AB_HOME_MTA)

Yes, I've also tried adding in the hex code directly (&H8007001E).

Yes, I did the session logon first. Although when I first ran it just
using the code snippet I found it worked! And the code never defined
what objSession was. Since then I did some changes and now I can't get
it to work.

I just don't get it.




[email protected] January 17th 06 11:02 PM

how to get Exchange server?
 
Hi Dmitry,

I managed to find another code snippet, tried it, and it worked!

However I don't entirely understand the logon parameters. I don't
specify a user profile, so what is it logging on as?

The code:

Set objSession = CreateObject("MAPI.Session")
objSession.Logon "", "", False, False, 0

Thx,

J.


Dmitry Streblechenko January 18th 06 12:28 AM

how to get Exchange server?
 
It uses the default profile name (whatever that happens to be).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

wrote in message
oups.com...
Hi Dmitry,

I managed to find another code snippet, tried it, and it worked!

However I don't entirely understand the logon parameters. I don't
specify a user profile, so what is it logging on as?

The code:

Set objSession = CreateObject("MAPI.Session")
objSession.Logon "", "", False, False, 0

Thx,

J.




[email protected] February 7th 06 05:52 PM

how to get Exchange server?
 
I ran into a problem that most users don't have the CDO plug-in.

So now what I want is instead of each user running the code and using
the CurrentUser.ID, I want one administrator to run the code and be
able to determine the Exchange server of a given user.

Eg. an email comes in from Joe Bloe. Run code to return the server that
Joe Bloe belongs to.

The objsession.logon parameters asks for the username and the exchange
server - so I'm in a catch22 situation. It's the server name I'm trying
to determine!

Any ideas?

Thx,

J.

Dmitry Streblechenko wrote:
It uses the default profile name (whatever that happens to be).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

wrote in message
oups.com...
Hi Dmitry,

I managed to find another code snippet, tried it, and it worked!

However I don't entirely understand the logon parameters. I don't
specify a user profile, so what is it logging on as?

The code:

Set objSession = CreateObject("MAPI.Session")
objSession.Logon "", "", False, False, 0

Thx,

J.



Dmitry Streblechenko February 8th 06 06:37 PM

how to get Exchange server?
 
Use the same EX server name as the one the admin uses. If the mailbox is
physically located on a different server, MAPI is smart enough to redirect.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

wrote in message
oups.com...
I ran into a problem that most users don't have the CDO plug-in.

So now what I want is instead of each user running the code and using
the CurrentUser.ID, I want one administrator to run the code and be
able to determine the Exchange server of a given user.

Eg. an email comes in from Joe Bloe. Run code to return the server that
Joe Bloe belongs to.

The objsession.logon parameters asks for the username and the exchange
server - so I'm in a catch22 situation. It's the server name I'm trying
to determine!

Any ideas?

Thx,

J.

Dmitry Streblechenko wrote:
It uses the default profile name (whatever that happens to be).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

wrote in message
oups.com...
Hi Dmitry,

I managed to find another code snippet, tried it, and it worked!

However I don't entirely understand the logon parameters. I don't
specify a user profile, so what is it logging on as?

The code:

Set objSession = CreateObject("MAPI.Session")
objSession.Logon "", "", False, False, 0

Thx,

J.






All times are GMT +1. The time now is 10:19 AM.

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