Adding a DL to an secondary Contacts Folder

H

Hal

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
 
S

Sue Mosher [MVP-Outlook]

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
 
M

Michael Bauer [MVP - Outlook]

Am Mon, 25 Sep 2006 19:33:02 -0700 schrieb Hal:

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

Hal

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

Sue Mosher [MVP-Outlook]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top