troubleshooting Question

Can't connect to Outlook via TOutlookApplication component

Avatar of Stef Merlijn
Stef MerlijnFlag for Netherlands asked on
DelphiOutlook
15 Comments1 Solution752 ViewsLast Modified:
Hi,

One of our customers has a problem with synchronizing scheduler events from Outlook to our application.
Customer PC details: Windows 10, Outlook 2010.
Our application uses component "TOutlookApplication" to connect to Outlook.
When connecting to Outlook the user is asked to close Outlook before starting sync.
procedure TForm1.btStartImportClick(Sender: TObject);
var Calendar: MAPIFolder;
      NmSpace: NameSpace;
begin
  try
    appOutlook.ConnectKind := ckRunningOrNew;
    appOutlook.Connect;
    try
      NmSpace := appOutlook.GetNamespace('MAPI');
      NmSpace.Logon('', '', False, False);
      Calendar := NmSpace.GetDefaultFolder(olFolderCalendar);
      ProgressBar1.Max := Calendar.Items.Count;
    except
      On E: EOleException do  // uses ComObj
      begin
        E.Message := FullOleExceptionMessage(E);
        ShowMessage(E.Message);
        Exit;
      end;
    end;
  finally
    appOutlook.Disconnect;
  end;
end;
The error which is given:
Cannot connect to MS Outlook server is unavailable
Error code: -2147221231 80040111
Facility: ITF code: 4

Does anybody have an idea how this can be solved?
ASKER CERTIFIED SOLUTION
Sinisa Vuk
Software architect

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Top Expert 2012

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Join our community to see this answer!
Unlock 1 Answer and 15 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros