Automation doesn't work in Outlook 2007 but in older Outlook versions?

B

Ben

Good day,

I have a strange (and annoying) problem with automating Outlook 2007.

Our company uses a small Delphi program to export addresses (contacts)
and appointments and uses COM to add the data to Outlook. This works
fine with Outlook 98 to Outlook 2003. Now a new PC came with Outlook
2007 and it "doesn't work", i.e. it just doesn't do anything. I've
read up on the increased security measures in OL 2007 but OL 2007
doesn't show any dialogs warning about a program trying to access
Outlook's data. I've also tried so sign the program's Exe to no avail.
Strangely, a small VBScript that adds a single appointment seems to
work without problems.

What I'd now like know is if it's an Outlook 2007 security problem,
since this is the only thing I can imagine, since the program works
with older OL versions.

A shortened version of the Delphi code looks like this:

// all variable types are OleVariants
CoInitialize(nil);
FOutlook := CoOutlookApplication.Create;
// if I print FOutlook.Version here, it correctly shows version "12.
(...)"
FNameSpace := FOutlook.GetNamespace('MAPI');
FContactsItems := FNamespace.GetDefaultFolder(olFolderContacts).Items;
// to add a contact, I do
Contact := FContactsItems.Add(olContactItem);
// and here it seems to stop working

I'd be thankful for any kind of help or advice.
Thanks a lot!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top