Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 30th, 2004, 12:54 PM
Authorized User
Join Date: Aug 2004
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Alcapone
Default Create outlook 2003 distributionlist


Anybody have any idea on how to create an distribution list in outlook 2003 with members that are created by looping through an listbox.

Old December 2nd, 2004, 09:01 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik

I know u can use office obj. lib. but havent worked yet with the subject u said (outlook) see http://msdn.microsoft.com/vstudio/office/ for more detail.

Keep in touch.

Hovik Melkomian.
Old December 22nd, 2004, 04:50 PM
Authorized User
Join Date: Aug 2004
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Alcapone

Thanks melvik for your reply.

I use this code which i found on msdn but still doens't work quit well... It creates the distribution list and inserts the first item from my listbox but nothing more...

 ApplicationClass myApp = new ApplicationClass() ;
NameSpace ns = myApp.GetNamespace("MAPI") ;
Outlook.DistListItem myDistList ;
Outlook.MailItem objItem =
(Outlook.MailItem)myApp.CreateItem(OlItemType.olMa ilItem);
=(Outlook.DistListItem)myApp.CreateItem(OlItemType .olDistributionListItem) ;
myDistList.DLName = cmb_curs.SelectedItem.ToString() ;
myDistList.Body = cmb_curs.SelectedItem.ToString() ;
foreach(string item in lstb_SelcUsrs.SelectedItems)
      objItem.Recipients.Add(item) ;
objItem.Recipients.ResolveAll() ;
myDistList.AddMembers(objItem.Recipients) ;
myDistList.Save() ;

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2003 Angel_oct11 C# 2005 2 November 13th, 2007 07:08 AM
Javascript in Outlook (2003) message POTSJ Javascript How-To 2 October 10th, 2007 07:38 AM
Outlook 2003 Email into Access annienml Access VBA 3 March 28th, 2007 03:51 AM
Outlook 97/2003 Mapi code chuckdaniels Access VBA 2 March 6th, 2005 04:09 PM
Outlook 2003 Hunter Pro VB.NET 2002/2003 0 January 5th, 2005 06:01 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.