PC Review


Reply
Thread Tools Rate Thread

Adding a distribution list to a distributionlist (distlistitem)

 
 
Søren Godthardt Hansen
Guest
Posts: n/a
 
      15th Sep 2005
Hey.

I need to add a distlistitem (a distribution list) as a sublist to another
distribution list, but I can't seem to find a method in the API which is
allowing it.

I have no problems adding recipients to the list, but I have come across a
limit to distribution lists at about 2KB (around 100 members), so therefore
I need build a list from a number of sublist.

Please help !

Søren


 
Reply With Quote
 
 
 
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      15th Sep 2005
Same method: Created a resolved Recipient using that DL.

The real question is whether a DL is an appropriate solution at all, given the management headaches.
--
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


"Søren Godthardt Hansen" <(E-Mail Removed)> wrote in message news:iHbWe.36$(E-Mail Removed)...
> Hey.
>
> I need to add a distlistitem (a distribution list) as a sublist to another
> distribution list, but I can't seem to find a method in the API which is
> allowing it.
>
> I have no problems adding recipients to the list, but I have come across a
> limit to distribution lists at about 2KB (around 100 members), so therefore
> I need build a list from a number of sublist.
>
> Please help !
>
> Søren
>
>

 
Reply With Quote
 
Søren Godthardt Hansen
Guest
Posts: n/a
 
      21st Sep 2005
Hey Sue.

Thank you for the answer - I bought your book "Microsoft Outlook
Programming", and found it extremely interesting - unfortunately it doesn't
answer this question.

When I try to cast a distlistitem to a recipient using the
distlistitem.addMember, I recieve a runtime error (as I would expect) - what
have I missed ??

The solution will not generate management headaches, since it is a read-only
export from a CRM (not MS) -database.

Best regards

Søren

"Sue Mosher [MVP-Outlook]" <(E-Mail Removed)> skrev i en meddelelse
news:%(E-Mail Removed)...
Same method: Created a resolved Recipient using that DL.

The real question is whether a DL is an appropriate solution at all, given
the management headaches.
--
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


"Søren Godthardt Hansen" <(E-Mail Removed)> wrote in message
news:iHbWe.36$(E-Mail Removed)...
> Hey.
>
> I need to add a distlistitem (a distribution list) as a sublist to another
> distribution list, but I can't seem to find a method in the API which is
> allowing it.
>
> I have no problems adding recipients to the list, but I have come across a
> limit to distribution lists at about 2KB (around 100 members), so
> therefore
> I need build a list from a number of sublist.
>
> Please help !
>
> Søren
>
>



 
Reply With Quote
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      21st Sep 2005
Could you show a code snippet, please?

--
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


"Søren Godthardt Hansen" <(E-Mail Removed)> wrote in message news:EvcYe.328$_(E-Mail Removed)...
> Hey Sue.
>
> Thank you for the answer - I bought your book "Microsoft Outlook
> Programming", and found it extremely interesting - unfortunately it doesn't
> answer this question.
>
> When I try to cast a distlistitem to a recipient using the
> distlistitem.addMember, I recieve a runtime error (as I would expect) - what
> have I missed ??
>
> The solution will not generate management headaches, since it is a read-only
> export from a CRM (not MS) -database.
>
> Best regards
>
> Søren
>
> "Sue Mosher [MVP-Outlook]" <(E-Mail Removed)> skrev i en meddelelse
> news:%(E-Mail Removed)...
> Same method: Created a resolved Recipient using that DL.
>
> The real question is whether a DL is an appropriate solution at all, given
> the management headaches.


>
> "Søren Godthardt Hansen" <(E-Mail Removed)> wrote in message
> news:iHbWe.36$(E-Mail Removed)...
>> Hey.
>>
>> I need to add a distlistitem (a distribution list) as a sublist to another
>> distribution list, but I can't seem to find a method in the API which is
>> allowing it.
>>
>> I have no problems adding recipients to the list, but I have come across a
>> limit to distribution lists at about 2KB (around 100 members), so
>> therefore
>> I need build a list from a number of sublist.
>>
>> Please help !
>>
>> Søren
>>
>>

>
>

 
Reply With Quote
 
Søren Godthardt Hansen
Guest
Posts: n/a
 
      3rd Oct 2005
Hey Sue.

Sub CreateDistList()
'Try to add a distribution list to a distribution list

Dim olApp As Outlook.Application
Dim objItem As DistListItem
Dim objItem2 As DistListItem
Dim objRcpnt As Recipient
Dim TempItem As Outlook.MailItem

Set olApp = Outlook.Application
Set TempItem = olApp.CreateItem(olMailItem)



'Create recipient for list
Set objRcpnt = TempItem.Recipients.Add("(E-Mail Removed)")
objRcpnt.Resolve

'Create a distribution list
Set objItem = olApp.CreateItem(olDistributionListItem)
objItem.DLName = "Main DistList"
objItem.Save

'Create another list to be added til the first (main)
Set objItem2 = olApp.CreateItem(olDistributionListItem)
objItem2.DLName = "Sub DistList"
objItem.AddMember objRcpnt
objItem2.Save

'OK - so fare


'This generates a type error (as I would expect)
objItem.AddMember objItem2
objItem.Save

End Sub


"Sue Mosher [MVP-Outlook]" <(E-Mail Removed)> skrev i en meddelelse
news:(E-Mail Removed)...
Could you show a code snippet, please?

--
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


"Søren Godthardt Hansen" <(E-Mail Removed)> wrote in message
news:EvcYe.328$_(E-Mail Removed)...
> Hey Sue.
>
> Thank you for the answer - I bought your book "Microsoft Outlook
> Programming", and found it extremely interesting - unfortunately it
> doesn't
> answer this question.
>
> When I try to cast a distlistitem to a recipient using the
> distlistitem.addMember, I recieve a runtime error (as I would expect) -
> what
> have I missed ??
>
> The solution will not generate management headaches, since it is a
> read-only
> export from a CRM (not MS) -database.
>
> Best regards
>
> Søren
>
> "Sue Mosher [MVP-Outlook]" <(E-Mail Removed)> skrev i en meddelelse
> news:%(E-Mail Removed)...
> Same method: Created a resolved Recipient using that DL.
>
> The real question is whether a DL is an appropriate solution at all, given
> the management headaches.


>
> "Søren Godthardt Hansen" <(E-Mail Removed)> wrote in message
> news:iHbWe.36$(E-Mail Removed)...
>> Hey.
>>
>> I need to add a distlistitem (a distribution list) as a sublist to
>> another
>> distribution list, but I can't seem to find a method in the API which is
>> allowing it.
>>
>> I have no problems adding recipients to the list, but I have come across
>> a
>> limit to distribution lists at about 2KB (around 100 members), so
>> therefore
>> I need build a list from a number of sublist.
>>
>> Please help !
>>
>> Søren
>>
>>

>
>



 
Reply With Quote
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      3rd Oct 2005
objItem2 is a DistListItem, not a Recipient. You can use CreateRecipient to return a Recipient object from objItem2:

Set recip = Application.Session.CreateRecipient(objItem2.Subject)

If the name of the DL is not unique or if the DL is not in a folder used for address solution, it won't resolve into a Recipient.

--
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


"Søren Godthardt Hansen" <(E-Mail Removed)> wrote in message news:a4a0f.1056$(E-Mail Removed)...
> Hey Sue.
>
> Sub CreateDistList()
> 'Try to add a distribution list to a distribution list
>
> Dim olApp As Outlook.Application
> Dim objItem As DistListItem
> Dim objItem2 As DistListItem
> Dim objRcpnt As Recipient
> Dim TempItem As Outlook.MailItem
>
> Set olApp = Outlook.Application
> Set TempItem = olApp.CreateItem(olMailItem)
>
>
>
> 'Create recipient for list
> Set objRcpnt = TempItem.Recipients.Add("(E-Mail Removed)")
> objRcpnt.Resolve
>
> 'Create a distribution list
> Set objItem = olApp.CreateItem(olDistributionListItem)
> objItem.DLName = "Main DistList"
> objItem.Save
>
> 'Create another list to be added til the first (main)
> Set objItem2 = olApp.CreateItem(olDistributionListItem)
> objItem2.DLName = "Sub DistList"
> objItem.AddMember objRcpnt
> objItem2.Save
>
> 'OK - so fare
>
>
> 'This generates a type error (as I would expect)
> objItem.AddMember objItem2
> objItem.Save
>
> End Sub
>
>> When I try to cast a distlistitem to a recipient using the
>> distlistitem.addMember, I recieve a runtime error (as I would expect) -
>> what
>> have I missed ??
>>
>> The solution will not generate management headaches, since it is a
>> read-only
>> export from a CRM (not MS) -database.
>>
>> Best regards
>>
>> Søren
>>
>> "Sue Mosher [MVP-Outlook]" <(E-Mail Removed)> skrev i en meddelelse
>> news:%(E-Mail Removed)...
>> Same method: Created a resolved Recipient using that DL.
>>
>> The real question is whether a DL is an appropriate solution at all, given
>> the management headaches.

>
>>
>> "Søren Godthardt Hansen" <(E-Mail Removed)> wrote in message
>> news:iHbWe.36$(E-Mail Removed)...
>>> Hey.
>>>
>>> I need to add a distlistitem (a distribution list) as a sublist to
>>> another
>>> distribution list, but I can't seem to find a method in the API which is
>>> allowing it.
>>>
>>> I have no problems adding recipients to the list, but I have come across
>>> a
>>> limit to distribution lists at about 2KB (around 100 members), so
>>> therefore
>>> I need build a list from a number of sublist.
>>>
>>> Please help !
>>>
>>> Søren
>>>
>>>

>>
>>

>
>

 
Reply With Quote
 
New Member
Join Date: Mar 2009
Posts: 1
 
      25th Mar 2009
Dear friends,I have a question.I have added the name of the sub distribution list to the main distribution list in graphical interfaces. But I don't know how to actualize that with VBA programe. Help me,please!
Thank you!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding distribution lists to a master distribution list. OldCoder Microsoft Outlook Form Programming 1 8th Jan 2008 09:01 PM
Adding mutliple distribution lists into a distribution list? =?Utf-8?B?QWJlbA==?= Microsoft Outlook Contacts 2 30th Aug 2006 05:51 PM
Redemption library - Add distribution list as member to another distributionlist Tommy Ipsen Microsoft Outlook 0 2nd Jun 2006 10:23 PM
Adding Contact and Distribution List Names to a List =?Utf-8?B?Q2xhcmtl?= Microsoft Outlook VBA Programming 1 4th Jan 2005 05:29 PM
OL2002: Adding list of contacts to a Distribution List after search PHiL M. Microsoft Outlook Contacts 9 15th Apr 2004 01:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:55 AM.