Here's an autohotkey script that goes offline for a defined duration and then online for a different defined duration. It requires also implementing VBA code (shown further below) to store the "sync" status in a persistent storage item. It's a pretty awful hack but seems to do the job.
{
TimeOff := 15
TimeOn := 1
Outlook := ComObjActive("Outlook.Application")
; always start online
if ( Outlook.GetNamespace("MAPI").Offline ) {
Outlook.ActiveExplorer.CommandBars.ExecuteMSO("ToggleOnline")
}
loop {
; go offline
Outlook.ActiveExplorer.CommandBars.ExecuteMSO("ToggleOnline")
; wait TimeOff minutes
Sleep TimeOff*60000
; go online
Outlook.ActiveExplorer.CommandBars.ExecuteMSO("ToggleOnline")
done := 1
; wait TimeOn minutes
Sleep TimeOn*60000
; force sync
Outlook.Session.SyncObjects.Item(1).start
; don't go offline again until sync is done
while (done != 0) {
done := Outlook.Session.GetDefaultFolder(6).GetStorage("sync",0).UserProperties("online").value
Sleep 1000
}
}
}
And then in Outlook VBA:
Public myStorage As Outlook.StorageItem
Private Sub Application_Startup()
SyncRunning = False
Set mySync = Session.SyncObjects.Item(1)
Set myStorage = Application.Session.GetDefaultFolder(olFolderInbox).GetStorage("sync", olIdentifyBySubject)
myStorage.UserProperties("online").Value = 10
myStorage.Save
End Sub
Private Sub mySync_SyncEnd()
myStorage.UserProperties("online").Value = 0
myStorage.Save
End Sub
Private Sub mySync_SyncStart()
myStorage.UserProperties("online").Value = 1
myStorage.Save
End Sub
Private Sub Application_Quit()
Set mySync = Nothing
End Sub