Tutorial :Presenting Outlook Global Address List


I need to create a control that has the same functionality as the Outlook To... button on a new email (i.e. when clicked, a modal dialog is created which holds the entire global address list within a listbox.)

I have no problems accessing this data, I ahve a list of AddressEntries which I want to present in the ListBox, however, due to the size of the data set (~300K records), this is proving very difficult.

I would like to avoid streaming 100 or so records at a time, as outlook does not do this.

Does anyone know of a good way to do this?

If it helps, the code I am using to get the address list is:

public AddressEntries GetGlobalAddressList()          {              Outlook.Application oApp = new Outlook.Application();              Outlook.NameSpace oNS = oApp.GetNamespace("mapi");              oNS.Logon(Missing.Value, Missing.Value, false, true);               Outlook.AddressLists oDLs = oNS.AddressLists;                Outlook.AddressList oGal = oDLs["Global Address List"];                Outlook.AddressEntry oEntry = default(Outlook.AddressEntry);                return oGal.AddressEntries;                         }  


Probably the easiest way is to use CDO's Session.AddressBook(). Or use redemption's (http://www.dimastr.com/redemption/) RDO AddressBook if you want to get round the security prompts etc.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »