objInfoStore.Fields(CdoPR_STORE_OFFLINE).Value and Cached Mode

  • Thread starter Thread starter Michael Kensy
  • Start date Start date
M

Michael Kensy

Hi,

I did use a folder Homepage which works fine with OL.2k and OL.XP but
not (I migrated to...) OL.2k3. It doesn't work fine at that statement:

IsOffline = objInfoStore.Fields(CdoPR_STORE_OFFLINE).Value

Problem is that the statement delivers 'true' if OL is connected to the
ExchangeServer but in Cached Mode ... disabling 'cached Mode' let it
work. So what property do I have to ask for in OL.2k3?

thanx in advance
Michael
 
What you get when you query for cached mode depends also on your version of
Exchange server. NameSpace.ExchangeConnectionMode (only available with
Outlook 2003 of course) has an enum that can return various cached and
uncached settings such as olCachedConnectedDrizzle and so on but with
Exchange 5.5 you get olNoExchange in cached mode. You can look up the
olExchangeConnectionMode enum in the Object Browser.

If you are going to be supporting various versions of Exchange server you
need to check for Exchange, and then if you get olNoExchange for
ExchangeConnectionMode you know it's some variation of cached mode.
 
Hi Ken,

thanxs for your reply ...
What you get when you query for cached mode depends also on your
version of Exchange server. NameSpace.ExchangeConnectionMode (only
available with Outlook 2003 of course) has an enum that can return
various cached and uncached settings such as olCachedConnectedDrizzle
and so on but with Exchange 5.5 you get olNoExchange in cached mode.
You can look up the olExchangeConnectionMode enum in the Object
Browser.


I tried as suggested and got my folderhomepage working again ...

If you are going to be supporting various versions of Exchange server
you need to check for Exchange, and then if you get olNoExchange for
ExchangeConnectionMode you know it's some variation of cached mode.


do you know some tested code to do so? Sorry for asking but I don't use
exchange 5.5 anymore but would like to prepare myHomepage for.

thanx in every case
Michael
 
The code I use requires CDO, which may not be available since it's an
optional installation for Outlook 2000 and later. First I get the Outlook
version (Application.Version) as a string and look at the 2 left characters
of the string. If the leftmost one is "9" it's Outlook 2000, if "10" it's
Outlook 2002 and if "11" it's Outlook 2003. Then I call the following
procedure.

' olConnectMode is a global defined as follows:
Public Enum OL2003ConnectionMode
CacheConnectDrizzle = 600
CacheConnectFull = 700
CacheConnectHeaders = 500
CacheDisconnect = 400
CacheOffline = 200
Disconnect = 300
NoExchange = 0
Offline = 100
Online = 800
End Enum

Public olConnectMode As OL2003ConnectionMode


Private Function UserOnline() As Boolean
On Error Resume Next

Const PR_STORE_OFFLINE = &H6632000B
Const CdoPR_PROVIDER_DISPLAY = &H3006001E

UserOnline = False
olConnectMode = Online

With g_objDefaultInfoStore 'gotten by using Inbox.StoreID and
Session.GetInfoStore
If g_lngVersion >= 10 Then 'g_lngVersion set as Outlook version as a
Long
UserOnline = Not (g_objApp.Session.Offline) 'not available for Outlook
2000
If g_lngVersion = 10 Then
If Not UserOnline Then
olConnectMode = Offline
End If
ElseIf g_lngVersion = 11 Then
olConnectMode = g_objApp.Session.ExchangeConnectionMode

If InStr(1, .Fields(CdoPR_PROVIDER_DISPLAY), _
"Microsoft Exchange", vbTextCompare) > 0 Then

If ((UserOnline) And (olConnectMode = NoExchange)) Then
olConnectMode = Offline
End If
End If
End If
Else
If InStr(1, .Fields(CdoPR_PROVIDER_DISPLAY), "Microsoft Exchange", _
vbTextCompare) > 0 Then

'Check if store is in offline mode
UserOnline = Not (.Fields(PR_STORE_OFFLINE).Value)

ElseIf InStr(1, .Fields(CdoPR_PROVIDER_DISPLAY), "Personal Folders", _
vbTextCompare) > 0 Then

UserOnline = True
End If

If Not UserOnline Then
olConnectMode = Offline
End If
End If
End With

If Err <> 0 Then
LogAddInErr Err, "clsAddin", "UserOnline", "Error!"
'Err.Clear
End If
End Function
 
Back
Top