Adding a DL to an secondary Contacts Folder

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If I have 2 contact folders (Contacts,Test). I want to add a DL list to Test.

If I use Set objDstList = olApp.CreateItem(olDistributionListItem) it puts
it in Contacts. How do I code the object to create objDstlist in folder Test
?

Thanks
 
Use the Add method on the target folder's Items collection, passing the message class ("IPM.DistList") as the argument.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Am Mon, 25 Sep 2006 19:33:02 -0700 schrieb Hal:

You can call the folder´s Items.Add function.
 
M

I cannt get it to work.. I know my VBA knowledge of outlook object model is
weak


Dim olApp As Outlook.Application
Dim objDstList As Outlook.DistListItem
Dim objNameSpace As Outlook.NameSpace
Dim objRcpnt As Outlook.Recipient
Dim objRcpnt2 As Outlook.Recipient
Dim objMail As Outlook.MailItem
Dim objRcpnts As Outlook.Recipients
Dim objContact As Outlook.ContactItem
Dim objContacts As Outlook.Items

Dim ObjCategories As Outlook.Items
Dim objCategory As Object
Dim ObjFolder As Outlook.MAPIFolder
Dim ObjMyFolder As Object
Dim myfolder As Outlook.Items
Dim myitem As Object
Dim myitems As Outlook.Items


Sub getname()
Set olApp = Outlook.Application
Set objNameSpace = olApp.GetNamespace("MAPI")
Set ObjFolder = objNameSpace.GetDefaultFolder(olFolderContacts)
' private contacts
Set ObjMyFolder = ObjFolder.Folders("test")

Set myfolder = ObjMyFolder
Set objDstList = myfolder.Items.Add("A1", olDistributionListItem)

end

*** how do I set myfolder to be pointing to the correct contacts list to add
? I want to add A1 to test
***
 
Set objDstList = myfolder.Items.Add("IPM.DistList")

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top