Solved

Problems using the VBA API to Outlook 2013 from a 2003 era application

Posted on 2015-01-20
8
229 Views
Last Modified: 2015-01-28
I have an existing application which is native to 2003 (mde format) which uses the Outlook API to synchronize meetings in the outlook calendar with my application database. It has worked fine in the past, interacting normally with Outlook 2007 and 2010 instances, but I now have a client using Outlook 2013 with Office 365 licencing and the process crashes with an obscure error. There is also a process which synchronizes contacts and that runs fine too. Everything is 32-bit - the application and the Office 2013 installation, etc.

Can anyone point me to any documentation on what might have changed with the API as far as compatibility to Outlook 2013? I found some references to recent API changes, but nothing relating to the methods and properties I'm using.
0
Comment
Question by:FirstStrikeSolutions
  • 4
  • 3
8 Comments
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 167 total points
ID: 40561223
Not sure, ...but note that you are trying to bridge a 10 year gap in technology here.

Also, note that it may be outlook causing the issue here because it is "profile based"

Does the Access 2003 MDB file work correctly with Acc 2013/365?

Have you tried crating an .accde file in 2013 and using that instead of the 2003 MDE file?


Lets see what other Experts may post.

JeffCoachman
0
 

Author Comment

by:FirstStrikeSolutions
ID: 40561256
Hi Jeff.

Yes, the application works fine with Access 2013 under 365 (as long as it's 32-bit due to some third party activeX objects). Even the contact synch function works ok in the same installation. I assume that there is some change in the API or the "meeting/event" data structure in Outlook 2013 calendar. I expect I will need to update the code to allow for the change, so maybe I will end up needing two versions - or try to detect the Outlook version and adjust accordingly in the code.

Making an accde is an option but is a pain since I would need to compile and distribute multiple versions. Some clients use 2003 still, otherwise, I would have done that some time ago. I actually develop in Access 2010 and then switch to 2003 to compile for distribution as an mde. I have a few tricks in the coding to behave a little differently when in 2007 and later (to handle form resizing in particular).

My next step is to get an mdb copy of the application to the client site and debug it. I don't like doing that, but I think I can trust the client and delete it fully afterwards to avoid leaving the source code in the "open". At least that might tell me the exact call which is triggering the obscure and unhelpful error message.
0
 
LVL 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 333 total points
ID: 40561561
What error are you getting?

When you refer to the "Outlook API", what exactly do you mean. Are you using MAPI calls (which is the Mail API, which is essentially the Outlook API) or are you using Automation (i.e. creating items in VBA code using CreateObject and such).

2013 has presented some challenges, since a lot of Outlook functionality is moving to the cloud with O365 stuff. In some cases, we've heard reports that Automation processes fail with O365 Outlook.

FWIW, 2013 does expose an API: https://msdn.microsoft.com/en-us/library/office/jj900714(v=office.15).aspx
0
 

Author Comment

by:FirstStrikeSolutions
ID: 40569723
I note that on the MSDN, there is mention of 2013 not coexisting with 2003 and earlier. Perhaps I am using an element which relates to 2003 and just need to find a more up-to-date version of the same thing. Hopefully it will still work with earlier Outlook installations. I need to get access to the client site to trace it, so will update later this week.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 333 total points
ID: 40569775
Versions of Access 2003 and earlier do not coexist with newer versions. In fact, most experienced devs have moved to using virtual machines to run multiple versions on the same machine.

That said - most elements of 2003 would "upgrade" to 2013, assuming you're not using the cloud-based version of Outlook (i.e. Outlook.com). If your workstations have Outlook actually installed on their desktop, then you should be okay. If not, and if the users are using the cloud based version only, then you'll have to rewrite the application to use those new APIs for the cloud.
0
 

Author Comment

by:FirstStrikeSolutions
ID: 40574560
OK, so I fixed the problem but not sure exactly how...

I copied the uncompiled MDB file to the client site and ran it in debug mode. Initially got the same error ("Call failed" with an obscure negative integer which looks like an address, not an error number). It looks like a mismatch between the VBA core module and the object library, rather than a message from it because it is very generic.

It was finding Appointment items ok but failing on the first reference to the Body property. That's the main text content of the appointment, so nothing which is likely to have changed between versions of the Outlook API. Then tracing it through to find which record it fails on (in case there was something funky about the value of a particular appointment), it ran through fine and finished correctly, doing everything as normal, deleting old appointments and creating new ones!

Checking the References, it was now pointing to the Outlook 15 Object Library (MSOUTL.OLB). Obviously, there is a mechanism in the Office configuration which moves this reference to the current version of Outlook, as my development one switches between Office 14 and Office 11 when I switch versions to build the common distribution. Thus, it appears to be a problem with distributing an MDE with a reference to an older copy of Outlook not being converted automatically - possibly because an MDE cannot be re-compiled.

I'm thinking that perhaps I can distribute the MDB version of that anyway as it's only an add-on application to the main product, and perhaps build the shortcut with the /decompile flag to force recompile each time it is run (it's not that big that it would delay the program start significantly).

Any follow-up insights welcome.
0
 

Author Closing Comment

by:FirstStrikeSolutions
ID: 40574562
I suppose the main outcome is to check the Reference to the Outlook object library and recompile.
0
 
LVL 84
ID: 40574835
Access is able to upgrade references regardless of whether you have a MDB or MDE file, so I'd assume your client has troubles with their installation of Windows or Office (or both).

Make sure they're fully updated, with all relevant hotfixes and such.
0

Featured Post

The problems with reply email signatures

Do you wish that you could place an email signature under a reply? Well, unfortunately, you can't. That great Exchange/Office 365 signature you've created will just appear at the bottom of an email chain. What a pain! Is there really no way to solve this? Well, there might be...

Join & Write a Comment

Companies keep a much closer eye on costs today, so changing to new Technology – Microsoft Office 365 is the smartest move to take.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now