Board index » delphi » Using Outlook as an Automation Server -problem closing down afterwards

Using Outlook as an Automation Server -problem closing down afterwards

I find I can access Outlook folders and contact lists etc by using
the following:

 OutLookApp : variant;

OutLookApp := CreateOLEObject('Outlook.Application');
...
...//process the folders etc.
..
OutLookApp := UnAssigned;  {close the automation server}

However, when I do this, the program will not close down
after execution, even with Application.TErminate,
or Halt.  This happens both within the IDE and
stand-alone.  Does anyone know why this
might happen?

Thanks :-)

Barry

--
Dr Barry Clark
Senior Lecturer
Medical Education Unit
11 Southpark Terrace,
University of Glasgow, G12 8QQ
Tel: 0141-330-4248
Fax: 0141-330-2776
Email: b.cl...@clinmed.gla.ac.uk

 

Re:Using Outlook as an Automation Server -problem closing down afterwards


<<Dr Barry Clark:
OutLookApp := UnAssigned;  {close the automation server}

Quote

Just decrementing the reference count doesn't work
with Office apps, you have to close them manually:

  NmSpace.Logoff;
  Outlook.Quit;
  Outlook := Unassigned; // Late binding with variants

--
Deborah Pate

Re:Using Outlook as an Automation Server -problem closing down afterwards


Do you have to use outlook?  You can do almost everything to exchange
folders, both private and public folders using the microsoft CDO library
from microsoft (although it is a little flaky - i'll point out some
issues if your interested).  This is much simpler, and is a direct
connection to the Exchange Server rather than Outlook.

I'll post more if your interested.

Just a suggestion

Toby Allen

Quote
Dr Barry Clark wrote:
> I find I can access Outlook folders and contact lists etc by using
> the following:

>  OutLookApp : variant;

> OutLookApp := CreateOLEObject('Outlook.Application');
> ...
> ...//process the folders etc.
> ..
> OutLookApp := UnAssigned;  {close the automation server}

> However, when I do this, the program will not close down
> after execution, even with Application.TErminate,
> or Halt.  This happens both within the IDE and
> stand-alone.  Does anyone know why this
> might happen?

> Thanks :-)

> Barry

> --
> Dr Barry Clark
> Senior Lecturer
> Medical Education Unit
> 11 Southpark Terrace,
> University of Glasgow, G12 8QQ
> Tel: 0141-330-4248
> Fax: 0141-330-2776
> Email: b.cl...@clinmed.gla.ac.uk

Re:Using Outlook as an Automation Server -problem closing down afterwards


Take a look at www.cdolive.com
Quote
Toby Allen wrote:
> Do you have to use outlook?  You can do almost everything to exchange
> folders, both private and public folders using the microsoft CDO library
> from microsoft (although it is a little flaky - i'll point out some
> issues if your interested).  This is much simpler, and is a direct
> connection to the Exchange Server rather than Outlook.

> I'll post more if your interested.

> Just a suggestion

> Toby Allen

> Dr Barry Clark wrote:

> > I find I can access Outlook folders and contact lists etc by using
> > the following:

> >  OutLookApp : variant;

> > OutLookApp := CreateOLEObject('Outlook.Application');
> > ...
> > ...//process the folders etc.
> > ..
> > OutLookApp := UnAssigned;  {close the automation server}

> > However, when I do this, the program will not close down
> > after execution, even with Application.TErminate,
> > or Halt.  This happens both within the IDE and
> > stand-alone.  Does anyone know why this
> > might happen?

> > Thanks :-)

> > Barry

> > --
> > Dr Barry Clark
> > Senior Lecturer
> > Medical Education Unit
> > 11 Southpark Terrace,
> > University of Glasgow, G12 8QQ
> > Tel: 0141-330-4248
> > Fax: 0141-330-2776
> > Email: b.cl...@clinmed.gla.ac.uk

Re:Using Outlook as an Automation Server -problem closing down afterwards


Does anyone know why the following code doesnt shut down outlook.
I have an app that auotmatically starts up outlook, using this code

Outlook.Connect;
     NmSpace := Outlook.GetNamespace('MAPI');
     NmSpace.Logon('', '', False, False);
     Folder := NmSpace.GetDefaultFolder(olFolderInBox);

this code is in the destroy event of my main form

NmSpace.Logoff;
     Outlook.Quit;
     OutLook.Disconnect;

after shutting down my app and pressing Ctrl+alt+delete, outlook is
still listed in the task manager.

mark.whee...@independentenergy.co.uk

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!

Other Threads