Workaround for sync multiple accounts into a single Outlook

Discuss about Group-Office development here

Moderator: Developers

Schorsch
Posts: 50
Joined: Wed Dec 10, 2008 8:55 pm

Workaround for sync multiple accounts into a single Outlook

Postby Schorsch » Sun Dec 28, 2008 1:27 pm

I looked for a way to show our secretary the calendars of her two bosses in her Outlook while the bosses themselves use Outlook or GO Webfrontend.
I developed the following workaround:
  • install Funambol Outlook Plugin (I installed in "c:\Programme\Funabol\Outlook Plug-in\")
  • start Outlook
  • set the options to login from "person1"
  • set sync options and do a complete sync
  • export the registry setting from HKEY_CURRENT_USER\Software\Funambol\OutlookClient\spds to file "c:\Programme\Funambol\Outlook Plug-in\person1.reg"
  • set the options to login from "person2"
  • set sync options and do a complete sync
  • export the registry setting from HKEY_CURRENT_USER\Software\Funambol\OutlookClient\spds to file "c:\Programme\Funambol\Outlook Plug-in\person2.reg"
  • Run regedit and delete the following entries to avoid loading the dll by Outlook:
    HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\Addins\FunambolAddin.Addin
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Outlook\Addins\FunambolAddin.Addin
Restart Outlook and create a "syncall.cmd" in "C:\Programme\Funambol\Outlook Plug-in", containing the following code:

Code: Select all

@echo off
rem Sync multiple GO3-Calendars into different calendars in Outlook-Account of current user
rem Version 0.1 alpha, GH, Wehmeyer Lifestyle GmbH, Aachen, Germany, christmas 2008
c:
cd "\Programme\Funambol\Outlook Plug-in"
rem load settings for person1, do sync in background and export settings after sync for person1
regedit /s .\person1.reg
.\OutlookPlugin.exe schedule
regedit /e .\person1.reg "HKEY_CURRENT_USER\Software\Funambol\OutlookClient\spds"
rem repeat for person2
regedit /s .\person2.reg
.\OutlookPlugin.exe schedule
regedit /e .\person2.reg "HKEY_CURRENT_USER\Software\Funambol\OutlookClient\spds"


Than you can use task scheduler to sync every 15 Minutes or whatever you like. You might also write an Outlook-Macro to call syncall.cmd minimized after start, after a scheduled time and before close of outlook.

For that create a new module in Outlook "timer":
Open VB-Editor (Alt+F11)
Call "Insert, Module"
Copy and paste following module:

Code: Select all

' <Module: timer>
Option Explicit

Private Declare Function SetTimer Lib "user32.dll" (ByVal hwnd As Long, _
  ByVal nIDEvent As Long, ByVal uElapse As Long, _
  ByVal lpTimerFunc As Long) As Long

Private Declare Function KillTimer Lib "user32.dll" (ByVal hwnd As Long, _
  ByVal nIDEvent As Long) As Long

Const WM_TIMER = &H113

Private m_oCallback As Object
Private hEvent As Long

Public Sub TimerProc(ByVal hwnd As Long, ByVal uMsg As Long, _
  ByVal wParam As Long, ByVal lParam As Long _
)
  If uMsg = WM_TIMER Then
    m_oCallback.timer
  End If
End Sub

Public Function EnableTimer(ByVal msInterval As Long, oCallback As Object) As Boolean
On Error Resume Next
  If hEvent <> 0 Then
    Exit Function
  End If
  hEvent = SetTimer(0&, 0&, msInterval, AddressOf TimerProc)
  Set m_oCallback = oCallback
  EnableTimer = CBool(hEvent)
End Function

Public Function DisableTimer()
  If hEvent = 0 Then
    Exit Function
  End If
  KillTimer 0&, hEvent
  hEvent = 0
End Function


Open Module "ThisOutlookSession"
Copy and Paste following code:

Code: Select all

Option Explicit
Public Sub ExecuteSync()
On Error Resume Next
    Dim poShell
    Set poShell = CreateObject("WScript.Shell")
    poShell.run "%COMSPEC% /c ""C:\Programme\Funambol\Outlook Plug-in\syncall.cmd""", 7
End Sub

Private Sub Application_Quit()
    'Remove the timer
    DisableTimer
    'Do a last sync
    Call ExecuteSync
End Sub

Private Sub Application_Startup()
    'Sync all GO-Accounts
    Call ExecuteSync
    'Create Timer to sync every 15 minutes
    EnableTimer 15 * 60000, Me
End Sub

Public Sub timer()
  ' Called from the timer
  Call ExecuteSync
End Sub


You will have to enable scripting and remove security for macros in Outlook, I think. Tested in Outlook 2003, SP3, german version.
Have Fun!

Georg
Last edited by Schorsch on Mon Dec 29, 2008 12:22 pm, edited 3 times in total.
mschering
Site Admin
Site Admin
Posts: 8154
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch
Contact:

Re: Workaround for sync multiple accounts into a single Outlook

Postby mschering » Mon Dec 29, 2008 9:58 am

I'll make this one sticky so more people can use this if they like!
Best regards,

Merijn Schering
Intermesh

Return to “Development Chats”

Who is online

Users browsing this forum: No registered users and 2 guests

cron