A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Exchange Server availability



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 8th 07, 10:53 AM posted to microsoft.public.outlook.program_vba
jeanluc
external usenet poster
 
Posts: 9
Default Exchange Server availability

I have some code I use to handle mail messages (Outlook 2003) with VB/VBA as
follows:

Dim objOutlook As Outlook.Application
Set objOutlook = CreateObject("Outlook.Application")
etc....

The code works fine except when the Exchange Server is unavailable (Popup
message Your Microsoft Exchange Server is unavailable / Retry - Work Offline
- Cancel)

Is it possible, programmatically (VB or VBA), to check the availability of
the Exchange Server before using Outlook features ?

Thanks a lot. Regards.

Jean-Luc

  #2  
Old January 8th 07, 07:23 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Exchange Server availability

Try checking the value of NameSpace.ExchangeConnectionMode. You should
always be able to retrieve a valid Outlook.Application object though,
regardless of what it is trying to connect to or it's connection state. You
didn't show all of your code so I don't know exactly what you are trying to
do or when.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"jeanLuc" wrote:

I have some code I use to handle mail messages (Outlook 2003) with VB/VBA as
follows:

Dim objOutlook As Outlook.Application
Set objOutlook = CreateObject("Outlook.Application")
etc....

The code works fine except when the Exchange Server is unavailable (Popup
message Your Microsoft Exchange Server is unavailable / Retry - Work Offline
- Cancel)

Is it possible, programmatically (VB or VBA), to check the availability of
the Exchange Server before using Outlook features ?

Thanks a lot. Regards.

Jean-Luc

  #3  
Old January 9th 07, 09:31 AM posted to microsoft.public.outlook.program_vba
jeanluc
external usenet poster
 
Posts: 9
Default Exchange Server availability

Thanks. I will try this and watch the behaviour of my scheduled job.
Rgrds
JL

"Eric Legault [MVP - Outlook]" wrote:

Try checking the value of NameSpace.ExchangeConnectionMode. You should
always be able to retrieve a valid Outlook.Application object though,
regardless of what it is trying to connect to or it's connection state. You
didn't show all of your code so I don't know exactly what you are trying to
do or when.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"jeanLuc" wrote:

I have some code I use to handle mail messages (Outlook 2003) with VB/VBA as
follows:

Dim objOutlook As Outlook.Application
Set objOutlook = CreateObject("Outlook.Application")
etc....

The code works fine except when the Exchange Server is unavailable (Popup
message Your Microsoft Exchange Server is unavailable / Retry - Work Offline
- Cancel)

Is it possible, programmatically (VB or VBA), to check the availability of
the Exchange Server before using Outlook features ?

Thanks a lot. Regards.

Jean-Luc

  #4  
Old January 24th 07, 03:00 PM posted to microsoft.public.outlook.program_vba
jeanluc
external usenet poster
 
Posts: 9
Default Exchange Server availability

Again me. I have tested around some solutions but I always have my problem.

Here the beginning of the code :

Set myOlApp = CreateObject("Outlook.Application") ' line 1
Set myNamespace = myOlApp.GetNamespace("MAPI") ' line 2
Set myFolder = myNamespace.GetDefaultFolder(olFolderInbox) ' line 3

When the program comes to the line 3, it brings me the popup Your
Microsoft Exchange Server is unavailable / Retry - Work Offline - Cancel
(wenn answering Retry to this popup, the program continue normally and
connect to Exchange)

I have inserted between line 2 and 3 following code, in order to give time
to the process to connect to exchange (stupid idea, perhaps ?) :

Open gsLogFile For Append As #1
nb_retry = 1
While myNamespace.ExchangeConnectionMode = olNoExchange _
Or myNamespace.ExchangeConnectionMode = olDisconnected _
Or myNamespace.ExchangeConnectionMode = olCachedDisconnected
PauseTime = 60
Start = Timer
Do While Timer Start + PauseTime
DoEvents
Loop
Print #1, "Dump " & myNamespace.ExchangeConnectionMode & " - check " &
nb_retry & " - " & Now
nb_retry = nb_retry + 1
If nb_retry 60 Then
GoTo end_main
End If
Wend
Close #1

Result : I always got 60 lines of dump in my logfile.
myNamespace.ExchangeConnectionMode never got another value then 0.
And it jump to the end of the program.

Any other idea, perhaps ?
Thanks and regards.

Jean-Luc
**********
"jeanLuc" wrote:

Thanks. I will try this and watch the behaviour of my scheduled job.
Rgrds
JL

"Eric Legault [MVP - Outlook]" wrote:

Try checking the value of NameSpace.ExchangeConnectionMode. You should
always be able to retrieve a valid Outlook.Application object though,
regardless of what it is trying to connect to or it's connection state. You
didn't show all of your code so I don't know exactly what you are trying to
do or when.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"jeanLuc" wrote:

I have some code I use to handle mail messages (Outlook 2003) with VB/VBA as
follows:

Dim objOutlook As Outlook.Application
Set objOutlook = CreateObject("Outlook.Application")
etc....

The code works fine except when the Exchange Server is unavailable (Popup
message Your Microsoft Exchange Server is unavailable / Retry - Work Offline
- Cancel)

Is it possible, programmatically (VB or VBA), to check the availability of
the Exchange Server before using Outlook features ?

Thanks a lot. Regards.

Jean-Luc

  #5  
Old January 24th 07, 10:38 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Exchange Server availability

You mentioned you were running this code as part of a scheduled job - that's
the problem:

The Outlook Object Model is unsuitable to run in a Windows service:
http://support.microsoft.com/default...b;en-us;237913

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"jeanLuc" wrote:

Again me. I have tested around some solutions but I always have my problem.

Here the beginning of the code :

Set myOlApp = CreateObject("Outlook.Application") ' line 1
Set myNamespace = myOlApp.GetNamespace("MAPI") ' line 2
Set myFolder = myNamespace.GetDefaultFolder(olFolderInbox) ' line 3

When the program comes to the line 3, it brings me the popup Your
Microsoft Exchange Server is unavailable / Retry - Work Offline - Cancel
(wenn answering Retry to this popup, the program continue normally and
connect to Exchange)

I have inserted between line 2 and 3 following code, in order to give time
to the process to connect to exchange (stupid idea, perhaps ?) :

Open gsLogFile For Append As #1
nb_retry = 1
While myNamespace.ExchangeConnectionMode = olNoExchange _
Or myNamespace.ExchangeConnectionMode = olDisconnected _
Or myNamespace.ExchangeConnectionMode = olCachedDisconnected
PauseTime = 60
Start = Timer
Do While Timer Start + PauseTime
DoEvents
Loop
Print #1, "Dump " & myNamespace.ExchangeConnectionMode & " - check " &
nb_retry & " - " & Now
nb_retry = nb_retry + 1
If nb_retry 60 Then
GoTo end_main
End If
Wend
Close #1

Result : I always got 60 lines of dump in my logfile.
myNamespace.ExchangeConnectionMode never got another value then 0.
And it jump to the end of the program.

Any other idea, perhaps ?
Thanks and regards.

Jean-Luc
**********
"jeanLuc" wrote:

Thanks. I will try this and watch the behaviour of my scheduled job.
Rgrds
JL

"Eric Legault [MVP - Outlook]" wrote:

Try checking the value of NameSpace.ExchangeConnectionMode. You should
always be able to retrieve a valid Outlook.Application object though,
regardless of what it is trying to connect to or it's connection state. You
didn't show all of your code so I don't know exactly what you are trying to
do or when.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"jeanLuc" wrote:

I have some code I use to handle mail messages (Outlook 2003) with VB/VBA as
follows:

Dim objOutlook As Outlook.Application
Set objOutlook = CreateObject("Outlook.Application")
etc....

The code works fine except when the Exchange Server is unavailable (Popup
message Your Microsoft Exchange Server is unavailable / Retry - Work Offline
- Cancel)

Is it possible, programmatically (VB or VBA), to check the availability of
the Exchange Server before using Outlook features ?

Thanks a lot. Regards.

Jean-Luc

  #6  
Old January 25th 07, 09:21 AM posted to microsoft.public.outlook.program_vba
jeanluc
external usenet poster
 
Posts: 9
Default Exchange Server availability

OK. Thanks.
Jean-Luc

"Eric Legault [MVP - Outlook]" wrote:

You mentioned you were running this code as part of a scheduled job - that's
the problem:

The Outlook Object Model is unsuitable to run in a Windows service:
http://support.microsoft.com/default...b;en-us;237913

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"jeanLuc" wrote:

Again me. I have tested around some solutions but I always have my problem.

Here the beginning of the code :

Set myOlApp = CreateObject("Outlook.Application") ' line 1
Set myNamespace = myOlApp.GetNamespace("MAPI") ' line 2
Set myFolder = myNamespace.GetDefaultFolder(olFolderInbox) ' line 3

When the program comes to the line 3, it brings me the popup Your
Microsoft Exchange Server is unavailable / Retry - Work Offline - Cancel
(wenn answering Retry to this popup, the program continue normally and
connect to Exchange)

I have inserted between line 2 and 3 following code, in order to give time
to the process to connect to exchange (stupid idea, perhaps ?) :

Open gsLogFile For Append As #1
nb_retry = 1
While myNamespace.ExchangeConnectionMode = olNoExchange _
Or myNamespace.ExchangeConnectionMode = olDisconnected _
Or myNamespace.ExchangeConnectionMode = olCachedDisconnected
PauseTime = 60
Start = Timer
Do While Timer Start + PauseTime
DoEvents
Loop
Print #1, "Dump " & myNamespace.ExchangeConnectionMode & " - check " &
nb_retry & " - " & Now
nb_retry = nb_retry + 1
If nb_retry 60 Then
GoTo end_main
End If
Wend
Close #1

Result : I always got 60 lines of dump in my logfile.
myNamespace.ExchangeConnectionMode never got another value then 0.
And it jump to the end of the program.

Any other idea, perhaps ?
Thanks and regards.

Jean-Luc
**********
"jeanLuc" wrote:

Thanks. I will try this and watch the behaviour of my scheduled job.
Rgrds
JL

"Eric Legault [MVP - Outlook]" wrote:

Try checking the value of NameSpace.ExchangeConnectionMode. You should
always be able to retrieve a valid Outlook.Application object though,
regardless of what it is trying to connect to or it's connection state. You
didn't show all of your code so I don't know exactly what you are trying to
do or when.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"jeanLuc" wrote:

I have some code I use to handle mail messages (Outlook 2003) with VB/VBA as
follows:

Dim objOutlook As Outlook.Application
Set objOutlook = CreateObject("Outlook.Application")
etc....

The code works fine except when the Exchange Server is unavailable (Popup
message Your Microsoft Exchange Server is unavailable / Retry - Work Offline
- Cancel)

Is it possible, programmatically (VB or VBA), to check the availability of
the Exchange Server before using Outlook features ?

Thanks a lot. Regards.

Jean-Luc

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Exchange Server Ian Outlook - Installation 1 October 17th 06 04:30 AM
Multiple email recipients with Shared Fax Server on Server 2003/Exchange 2003 [email protected] Outlook - Fax Functions 2 October 10th 06 01:11 AM
Cannot connect to Exchange server from Outlook client on Windows 2003 Server AllenM Outlook - General Queries 0 May 16th 06 07:44 PM
!!HELP!!! Cannot connect to Exchange Server from a RDP, ICA session or server local machine AllenM Outlook - General Queries 0 May 11th 06 11:14 PM
how to get Exchange server? [email protected] Outlook and VBA 5 February 8th 06 06:37 PM


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-2025 Outlook Banter.
The comments are property of their posters.