A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Nested distribution lists



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 12th 06, 01:02 AM posted to microsoft.public.outlook.program_vba
Hal
external usenet poster
 
Posts: 22
Default Nested distribution lists

I know how to make a new DL and add users to a DL via vba but how do I make a
nested distribution list ?

Regards
Ads
  #2  
Old October 12th 06, 06:54 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Nested distribution lists

Create a dummy e-mail message and address it to the DL you want to nest.
Then retrieve that DL's Recipient object from the MailItem.Recipients
collection and pass it to the DistributionList.AddMember method.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Hal" wrote:

I know how to make a new DL and add users to a DL via vba but how do I make a
nested distribution list ?

Regards

  #3  
Old October 13th 06, 04:27 AM posted to microsoft.public.outlook.program_vba
Hal
external usenet poster
 
Posts: 22
Default Nested distribution lists

what do you mean pass it to ... do I set distributionlist =
mailitem.receipient ?

"Eric Legault [MVP - Outlook]" wrote:

Create a dummy e-mail message and address it to the DL you want to nest.
Then retrieve that DL's Recipient object from the MailItem.Recipients
collection and pass it to the DistributionList.AddMember method.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Hal" wrote:

I know how to make a new DL and add users to a DL via vba but how do I make a
nested distribution list ?

Regards

  #4  
Old October 13th 06, 08:22 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Nested distribution lists

Actually, there's another way to do this without creating a dummy e-mail.
This code illustrates retrieving a DL named "TestDistributionList" and adding
another existing DL named "AnotherDistributionList" to it:

Dim objNS As Outlook.NameSpace
Dim objDL As Outlook.DistListItem
Dim objContacts As Outlook.MAPIFolder
Dim objR As Outlook.Recipient

Set objNS = Application.GetNamespace("MAPI")
Set objContacts = objNS.GetDefaultFolder(olFolderContacts)
Set objDL = objContacts.Items("TestDistributionList")
Set objR = objNS.CreateRecipient("AnotherDistributionList")

objR.Resolve
objDL.AddMember objR
objDL.Save

Set objDL = Nothing
Set objNS = Nothing
Set objContacts = Nothing
Set objR = Nothing

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Hal" wrote:

what do you mean pass it to ... do I set distributionlist =
mailitem.receipient ?

"Eric Legault [MVP - Outlook]" wrote:

Create a dummy e-mail message and address it to the DL you want to nest.
Then retrieve that DL's Recipient object from the MailItem.Recipients
collection and pass it to the DistributionList.AddMember method.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Hal" wrote:

I know how to make a new DL and add users to a DL via vba but how do I make a
nested distribution list ?

Regards

  #5  
Old October 14th 06, 03:59 AM posted to microsoft.public.outlook.program_vba
Hal
external usenet poster
 
Posts: 22
Default Nested distribution lists

Eric

Your code does not produce a DL named AnotherDistributionList in
TestDistributionList. I have tested in on a pst and when connected to
exchange.

Hal

"Eric Legault [MVP - Outlook]" wrote:

Actually, there's another way to do this without creating a dummy e-mail.
This code illustrates retrieving a DL named "TestDistributionList" and adding
another existing DL named "AnotherDistributionList" to it:

Dim objNS As Outlook.NameSpace
Dim objDL As Outlook.DistListItem
Dim objContacts As Outlook.MAPIFolder
Dim objR As Outlook.Recipient

Set objNS = Application.GetNamespace("MAPI")
Set objContacts = objNS.GetDefaultFolder(olFolderContacts)
Set objDL = objContacts.Items("TestDistributionList")
Set objR = objNS.CreateRecipient("AnotherDistributionList")

objR.Resolve
objDL.AddMember objR
objDL.Save

Set objDL = Nothing
Set objNS = Nothing
Set objContacts = Nothing
Set objR = Nothing

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Hal" wrote:

what do you mean pass it to ... do I set distributionlist =
mailitem.receipient ?

"Eric Legault [MVP - Outlook]" wrote:

Create a dummy e-mail message and address it to the DL you want to nest.
Then retrieve that DL's Recipient object from the MailItem.Recipients
collection and pass it to the DistributionList.AddMember method.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Hal" wrote:

I know how to make a new DL and add users to a DL via vba but how do I make a
nested distribution list ?

Regards

  #6  
Old October 14th 06, 06:54 AM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Nested distribution lists

The code isn't making another DL. It assume the existence of both
AnotherDistributionList and TestDistributionList. It retrieves the latter
and adds the former as a member.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Hal" wrote:

Eric

Your code does not produce a DL named AnotherDistributionList in
TestDistributionList. I have tested in on a pst and when connected to
exchange.

Hal

"Eric Legault [MVP - Outlook]" wrote:

Actually, there's another way to do this without creating a dummy e-mail.
This code illustrates retrieving a DL named "TestDistributionList" and adding
another existing DL named "AnotherDistributionList" to it:

Dim objNS As Outlook.NameSpace
Dim objDL As Outlook.DistListItem
Dim objContacts As Outlook.MAPIFolder
Dim objR As Outlook.Recipient

Set objNS = Application.GetNamespace("MAPI")
Set objContacts = objNS.GetDefaultFolder(olFolderContacts)
Set objDL = objContacts.Items("TestDistributionList")
Set objR = objNS.CreateRecipient("AnotherDistributionList")

objR.Resolve
objDL.AddMember objR
objDL.Save

Set objDL = Nothing
Set objNS = Nothing
Set objContacts = Nothing
Set objR = Nothing

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Hal" wrote:

what do you mean pass it to ... do I set distributionlist =
mailitem.receipient ?

"Eric Legault [MVP - Outlook]" wrote:

Create a dummy e-mail message and address it to the DL you want to nest.
Then retrieve that DL's Recipient object from the MailItem.Recipients
collection and pass it to the DistributionList.AddMember method.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Hal" wrote:

I know how to make a new DL and add users to a DL via vba but how do I make a
nested distribution list ?

Regards

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding mutliple distribution lists into a distribution list? Abel Outlook - Using Contacts 2 August 30th 06 06:51 PM
Distribution Lists sourced from linked SharePoint Contact Lists Marcela Outlook - Using Contacts 4 July 17th 06 01:08 AM
Distribution Lists Ada Outlook - Using Contacts 3 May 12th 06 12:09 AM
Distribution Lists Christine Outlook - Using Contacts 2 March 20th 06 09:43 PM
Nested Distribution Lists in shared contacts don't work Doda McCheesle Outlook - Using Contacts 0 February 24th 06 01:02 PM


All times are GMT +1. The time now is 07:12 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.