Free busy update

  • Thread starter Thread starter Semut
  • Start date Start date
S

Semut

Hello,

I notice that the freebusy information is not updated unless I restart
the Outlook. Anyway to make it update the cache without having to restart
the Outlook?

Any place or registry to set?

Or any VBA to call?


thanks
 
No, you can't do it with code. But you can do it manually by selecting Tools
-> Send/Receive -> Free/Busy Information.
 
Sorry, I spoke to soon. It occurred to me that you can set a reference to
that menu item and execute it:

Public Sub SendReceiveFreeBusy()

Dim oCtl As Office.CommandBarControl
Dim oPop As Office.CommandBarPopup
Dim oCB As Office.CommandBar

Set oCB = ActiveExplorer.CommandBars("Menu Bar")
Set oPop = oCB.Controls("Tools")
Set oPop = oPop.Controls("Send/Receive")
Set oCtl = oPop.Controls("Free/Busy Information")
oCtl.Execute

Set oCtl = Nothing
Set oPop = Nothing
Set oCB = Nothing
End Sub
 
"=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==?="
No, you can't do it with code. But you can do it manually by
selecting Tools -> Send/Receive -> Free/Busy Information.

You _can_ do it with code, just not OOM code; you need a bit of magic,
but this should do the trick:

Const PR_RECALCULATE_FREEBUSY = &H10F2000B
Const PR_FREEBUSY_DATA = &H686C0102
'Get Root Folder --- IPM_ROOT folder
Set objRoot = objCdoSession.GetFolder("")

'Open FreeBusy Data folder
Set objFreeBusyFolder = objRoot.Folders.Item("FreeBusy Data")

'Get List of message in FreeBusy Data Folder
set objMessageList = objFreeBusyFolder.Messages

'Loop through messages looking for message with LocalFreebusy as subject
For Each objMessage In objMessageList
' Update message
If objMessage.Subject = "LocalFreebusy" Then
Set objField = objMessage.Fields
objField.Item(PR_FREEBUSY_DATA).Delete
objField.Add PR_RECALCULATE_FREEBUSY, False
objMessage.Update
Exit For
End If
Next

-- dan
 
"=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==?="
Slick! But does calling the Update method on the hidden message
actually transmit the updated Free/Busy info right away, as it does
when you manually do it via Send/Receive?

Hm. I don't know offhand, I'd have to try it -- to be honest, that's just
a snippet of code I had saved away. As far as I know, it'll recalculate
the freebusy info immediately, but then again I'm looking at this from a
CDO point of view where you'd have to read the freebusy info from code
anyway, there's no UI that might want to update.

From what I remember of writing Outlook extensions, if you make changes
without using the OOM and rely on Outlook to notice, Outlook updates
itself when it's good and ready, which may be now, it may be later, it may
be when the moon is next full, it may be when the cows come home.. Your
method firing the menu item would be a much better approach for code
that's already running inside Outlook, definitely.

-- dan
 
thanks everyone for the answers.



Eric Legault said:
Sorry, I spoke to soon. It occurred to me that you can set a reference to
that menu item and execute it:

Public Sub SendReceiveFreeBusy()

Dim oCtl As Office.CommandBarControl
Dim oPop As Office.CommandBarPopup
Dim oCB As Office.CommandBar

Set oCB = ActiveExplorer.CommandBars("Menu Bar")
Set oPop = oCB.Controls("Tools")
Set oPop = oPop.Controls("Send/Receive")
Set oCtl = oPop.Controls("Free/Busy Information")
oCtl.Execute

Set oCtl = Nothing
Set oPop = Nothing
Set oCB = Nothing
End Sub
 
thanks for the answer.



Dan Mitchell said:
"=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==?="


You _can_ do it with code, just not OOM code; you need a bit of magic,
but this should do the trick:

Const PR_RECALCULATE_FREEBUSY = &H10F2000B
Const PR_FREEBUSY_DATA = &H686C0102
'Get Root Folder --- IPM_ROOT folder
Set objRoot = objCdoSession.GetFolder("")

'Open FreeBusy Data folder
Set objFreeBusyFolder = objRoot.Folders.Item("FreeBusy Data")

'Get List of message in FreeBusy Data Folder
set objMessageList = objFreeBusyFolder.Messages

'Loop through messages looking for message with LocalFreebusy as subject
For Each objMessage In objMessageList
' Update message
If objMessage.Subject = "LocalFreebusy" Then
Set objField = objMessage.Fields
objField.Item(PR_FREEBUSY_DATA).Delete
objField.Add PR_RECALCULATE_FREEBUSY, False
objMessage.Update
Exit For
End If
Next

-- dan
 
ok, this is OT.

In my Outlook, if "Free/Busy Information" menu is dim/disabled. That
would make this function unavailable, is it?


Other ways (OL 2000 to OL2003 compliance) to have Outlook to clear
freebusy cache?

thank you.
 
Back
Top