Unattended Journal updates

J

jj

I have an application that runs 24/7 and is not a windows service. It
uses the exchange/outlook journal folder to store status information
while running.

The issue is if the network/exchange server goes down, a popup box is
generated from Outlook stating the exchange server is unavailable with
"Retry" "Work Offline" and "Cancel" buttons. This popup halts execution
until one of the buttons is pushed.

I need to either trap the event before it happens so I can avoid the
popup, check the exchange server outside Outlook to avoid the popup, or
access the journal folders using some method othen than the Outlook
object.

Below is a snip of the code as it sits today.
--------------------------------
Try
Dim objOutlook As New Outlook.Application()
Dim objNameSpace As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder

objNameSpace = objOutlook.GetNamespace("MAPI")

' check if the connection is offline... this still causes the popup
'
If objNameSpace.Offline Then
StatusObj.MsgTxt = "Outlook; Exchange server offline"
StatusObj.Msgerr = True
StatusObj.AddMsg()
objOutlook = Nothing
objNameSpace = Nothing
objFolder = Nothing
GoTo Cleanup
End If
objFolder = objNameSpace.GetDefaultFolder
(Outlook.OlDefaultFolders.olFolderJournal)

Dim objJournalEntry As Outlook.JournalItem
objJournalEntry = DirectCast(objFolder.Items.Add
(Outlook.OlItemType.olJournalItem), Outlook.JournalItem)
objJournalEntry.Type = "Info Msgs"
objJournalEntry.Subject = Format(Now(), "MMM-dd-yyyy HH:mm")
objJournalEntry.Body = topForm.StatusMsg.Text
objJournalEntry.Save()
objJournalEntry = Nothing
objOutlook = Nothing
objNameSpace = Nothing
objFolder = Nothing
Catch ex As Exception
StatusObj.MsgTxt = "Outlook Journal Error: " & ex.ToString
StatusObj.Msgerr = True
StatusObj.AddMsg()
GoTo CleanUp
End Try
--------------------------
 
Top