1
votes

I am currently using Windows 7, Outlook 2010 with Exchange MAPI accounts. Several users have their personal account + several generic accounts (some with full access, some read only) The users execute a macro in VBA to connect to a specific mail adress/account to read check the incoming mails from the inbox on different criteria.

This code snipet connects to the MAPI Account and sets the folder to the inbox of a mail account:

Dim ns As Outlook.NameSpace
Dim Inbox As Outlook.Folder
Set ns = GetNamespace("MAPI")
Set Inbox = ns.Folders.Item("jon.doe@example.com").Folders("Inbox")

Now the IT decided to upgrade their servers to Exchange 2016. Those account will not use MAPI. IT said they now use REST API.

I suppose that's why I now receive this error message, when executing the code above with Outlook and Exchange 2016 and now Windows 10. VBA Runtime Error

I found online several solutions, but all of them need Visual Studio + Addins/Libraries. I want to do this with VBA and also connect to a mail account and inbox, so without Visual Studio, C#.

Best regards

Janko

1

1 Answers

0
votes

Now the IT decided to upgrade their servers to Exchange 2016. Those account will not use MAPI. IT said they now use REST API.

This is not technically correct Exchange 2016 doesn't yet support the new Outlook Rest API (although it has been announced that this will be introduced in the future). If you using Office365 then can use REST. Another alternative that will work against any version of Exchange is to use EWS https://msdn.microsoft.com/en-us/library/office/dn567668(v=exchg.150).aspx .

Another thing that should be pointed out is that regardless of Exchange version 2010,2016 or Office365 Outlook uses MAPI to connect to Exchange (along with EWS for various features). The difference between versions is the Method of connection eg in 2016 by default Mapi over HTTP is the preferred connectivity mech in previous versions in was RPC/HTTP (Outlook Anywhere). Its the same protocol just a different transport but from an Outlook code/client perspective its relatively transparent once the profiles have been created and the connection established. One thing that wouldn't work is trying to do a direct RPC/Mapi connection to Exchange 2016 (or 2013 for that matter).In theory your VBA code should still work if all Mailboxes are hosted in the same org but what you IT department is telling you isn't correct (unless they have specifically disabled MAPI on those mailbox which you could do in previous version of Exchange).