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

Tags: , , ,

Adding a DL to an secondary Contacts Folder





 
 
Thread Tools Display Modes
  #1  
Old September 26th 06, 04:33 AM posted to microsoft.public.outlook.program_vba
Hal
external usenet poster
 
Posts: 22
Default Adding a DL to an secondary Contacts Folder

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
Ads
  #2  
Old September 26th 06, 04:44 AM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Adding a DL to an secondary Contacts Folder

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
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Hal" wrote in message ...
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

  #3  
Old September 26th 06, 06:47 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,264
Default Adding a DL to an secondary Contacts Folder

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

You can call the folder“s Items.Add function.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --


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

  #4  
Old September 26th 06, 07:44 AM posted to microsoft.public.outlook.program_vba
Hal
external usenet poster
 
Posts: 22
Default Adding a DL to an secondary Contacts Folder

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

"Michael Bauer [MVP - Outlook]" wrote:

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

You can call the folder“s Items.Add function.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --


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


  #5  
Old September 26th 06, 08:41 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Adding a DL to an secondary Contacts Folder

Set objDstList = myfolder.Items.Add("IPM.DistList")

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

"Hal" wrote in message ...
M

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


 




Thread Tools
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
Advanced - Adding a Secondary pst file without opening Outlook. Any help would be appreciated Outlook - Installation 1 August 30th 06 08:30 PM
Adding a shared contacts folder as an Outlook Address Boook EJB Outlook - Using Contacts 7 August 16th 06 07:59 PM
Adding addresses to contacts folder PEP Outlook - Using Contacts 1 July 20th 06 10:44 PM
Adding Subject Column to Sent Items Folder joelhoh Outlook - Installation 2 April 26th 06 03:46 PM
Adding Public Folder Calendar to Outlook Jim H Outlook - Calandaring 1 March 4th 06 07:46 PM


All times are GMT +1. The time now is 03:09 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Web Advertising - Debt Help - Share Prices - MPAA - Credit Cards