Wednesday, 10 February 2016

Enumerating entries from Global Address List for Microsoft Outlook Interop

I used to use this code below to access the Global Address List of all Microsoft Outlook list of email addresses.

          Outlook.AddressList gal = outlookApp.Session.GetGlobalAddressList();

where "outLookApp" is

          Microsoft.Office.Interop.Outlook.Application outlookApp = new Microsoft.Office.Interop.Outlook.Application();

however one day that code doesn't work anymore for some reason and I looked around and have used these codes instead:

          Outlook.AddressLists addrLists = outlookApp.Session.AddressLists;
          Outlook.AddressList gal = addrLists["Global Address List"];

which did the trick!

I'll have to do some checking what's the difference and what have changed. Next time....




No comments:

Post a Comment