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