![]() |
Adding Distribution list to an e-mail with multiple mailboxes
Hi
I'm fairly new to VB so please bear with me if my methods are obscure! At work I have my own inbox and a shared mailbox which contains some group distribution lists. I'm trying to create a Macro that sends an e- mail to one of these distribtions lists, however, I'm struggling to add it to my e-mail. So far, I've tried the following piece of code... Dim myRecipient As DistListItem Set myRecipient = GetNamespace("MAPI").Folders.Item("Mailbox - Nimrod_operations_Team_mail (UK)").Folders.Item("Distribution Lists").Items("Test Distribution") With Application.CreateItem(olMailItem) .Recipients.Add (myRecipient) .Recipients.ResolveAll .Save .Display End With Yet, all this does is add the text 'Test Distribution' to the e-mail To: box and doesn't recognise it as a distribution list. Where do I go from here? Regards Jamie |
Adding Distribution list to an e-mail with multiple mailboxes
That approach won't work unless you've added the shared mailbox's Distribution Lists folder to the your own Outlook Address Book (a rather involved process), because Outlook cannot resolve the DL.
What you should be able to do, though, is use the DistListItem.GetMember method to iterate the DL's members and add each individual address to the message. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Jamie" wrote in message ups.com... Hi I'm fairly new to VB so please bear with me if my methods are obscure! At work I have my own inbox and a shared mailbox which contains some group distribution lists. I'm trying to create a Macro that sends an e- mail to one of these distribtions lists, however, I'm struggling to add it to my e-mail. So far, I've tried the following piece of code... Dim myRecipient As DistListItem Set myRecipient = GetNamespace("MAPI").Folders.Item("Mailbox - Nimrod_operations_Team_mail (UK)").Folders.Item("Distribution Lists").Items("Test Distribution") With Application.CreateItem(olMailItem) .Recipients.Add (myRecipient) .Recipients.ResolveAll .Save .Display End With Yet, all this does is add the text 'Test Distribution' to the e-mail To: box and doesn't recognise it as a distribution list. Where do I go from here? Regards Jamie |
All times are GMT +1. The time now is 09:34 PM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com