Outlook object model and SyncObjects

  • Thread starter Thread starter Petr Jarkovsky
  • Start date Start date
P

Petr Jarkovsky

Hi,

I have the problem with Outlook object model and SyncObjects.
When I use something like OutApp.Session.SyncObjects.Item(1).Start, it works
fine, but I need to catch events OnSyncStart, OnSyncEnd, OnProgress and
OnError. So, I wrote my own class (in Delphi, inherited from TOleServer) for
connecting to SyncObject and listening for these events.

When I connect to any SyncObject (e.g. OutApp.Session.SyncObjects.Item(1)),
the calling Start method of this object raise an exception with message:
'Cann't get synchronization objects in Outlook application. This problem is
obviously caused by the wrong configuration of Outlook application for
offline mode.' (translated to English).

I used some examples from MSDN and other web sites, I used even original
example code from Borland, but I still get the same error.

Can someone help me?

Petr Jarkovsky
 
I found a solution of this problem.
I must hold an active Explorer object in memory. Just only in some variable.
Then I can use SyncObjects without raising the exception.

e.g.:
in initialization section:
inbox := OutlookApp.Outlook.Session.GetDefaultFolder(olFolderInbox);
explorer := inbox.GetExplorer(EmptyParam);

in finalization section:
explorer.Close;
explorer := nil;
inbox := nil;

Petr Jarkovsky
 
Back
Top