Script Adding Entries to Distribution Lists in the GAL


Last week, a reader named Ashwath posted a comment asking about the possibility of updating a public distribution list. Here’s what Ashwath said.

I am trying to find an automated way to add members to a Public Distribution List on the Global Address List. Right now, the only way to do it is to manually look up for a contact one by one in the Global Address List and then add them, but I’ve close to 300+ names to do this. Would you be help to help with a macro for either outlook 2007/Excel 2007 that can automatically pick e-mail addresses from an excel sheet and then add them to the PDL?

P.S: This Distribution List is not an Outlook Distribution List. It is a Distribution List created on the GLobal Address List by my ‘IT’ department; so there is no easy way to copy and paste multiple e-mail addresses.

Public distribution lists (i.e. a mail enabled Active Directory groups) have little to do with Outlook from a scripting perspective. They reside in Active Directory and are not created or updated through the scripting of Outlook. Instead, they are handled through ADSI (Active Directory Services Interfaces) scripting. Although the solution doesn’t involve Outlook, I could have written the necessary script in VBA and run it from either Outlook or Excel. There’s little point to doing it in Outlook, and it makes more sense to keep the script outside of Excel since that will give Ashwath more flexibility. In my opinion, the best solution is to create the script using VBscript, which is the approach I’ve taken here. One of the benefits of using VBscript is that Ashwath can drop the script in his computer’s Send to folder, allowing him to send a spreadsheet to the script for processing. With this approach, Ashwath can even update different distribution lists from the same spreadsheet.
Continue reading

Advertisements