Article Options
Premium Sponsor
Premium Sponsor

 »  Home  »  Windows Development  »  Interop  »  Using C# to Create Distribution Lists  »  Attached Sample
Using C# to Create Distribution Lists
by Muthukumar V | Published  05/10/2005 | Interop | Rating:
Muthukumar V
I am a Programmer in C++/VC++/C#. http://www.codersource.net 

View all articles by Muthukumar V...
Attached Sample

The attached sample includes two parts. One is the set of classes which can be reused as such for any C# DL Creation programs or may be extended. The second is the DL Creation functional part. This extensively uses CDO libraries for finding the necessary Server names, Site Names and the much needed Object Distinguished names for many entities.

   The attached sample project can be downloaded here.

Reusable Classes:

   There are two classes available in the DLManagement namespaces which can be used in other C# programs. One class called DLManager, holds the utility functions which could be used for common operations required for creation or modifications of distribution list. The other class DistributionList, holds the data regarding the Distribution List.

   These reusable classes can be downloaded here.

DLManager:

   Some of the functions in this DLManager are described as below. All the functions in this class are static public members. So they can be used without instantiating this class.

  • GetSites   - This function can return a list of sites under an Exchange organization.
  • GetOrganization - This function returns the Organization name for a CDO Address entry object
  • IsLDAPEntryWithSlashes - Some properties of Exchange 5.5 need the entries with comma separated names in Object Distinguished Names. This function can be used to check if the entry contains slashes.
  • GetHomeServer - This can be used to find the Home server for a particular distribution list.
  • UpdateDL     - This function can be used for either creating or modifying a DL. This takes care of setting all the above said properties, including adding the owner of the DL with its Security Descriptor.
  • FindDL - This function can find and populate the details of a DL and return an object of DistributionList class.
  • FindSMTPAddressing - This function gets the SMTP Addressing format for a site using ADO.

DistributionList:

   This class contains only data members to hold the properties of DLs. This can be used either way to retrieve or update the Distribution Lists using the DLManager class.

Requirements:

    This application was written with Visual Studio .Net 2003. The Libraries used are as follows:

  • Microsoft CDO 1.21 Libraries. This is available by default in your system if Outlook 2000 or above is installed.
  • ADODB. This can be included from References --> Com --> Microsoft ActiveX Data Objects 2.6 & above.
  • System.DirectoryServices
How would you rate the quality of this article?
1 2 3 4 5
Poor Excellent
Tell us why you rated this way (optional):

Article Rating
The average rating is: No-one else has rated this article yet.

Article rating:3.72727272727273 out of 5
 11 people have rated this page
Article Score24214
Related Articles
Attachments
Comments    Submit Comment

Comment #1  (Posted by an unknown user on 10/07/2005)
Rating
good
 
Comment #2  (Posted by David Smith on 09/15/2006)
Rating
As it came, it didn't work. I added a reference to Interop.MAPI, the added 'using MAPI;', at which point it built successfully - but when run, nothing happened. When I checked, there was no startup object, so I selected the form. Same result - nothing came up.

So, my question is - did you EVER run this yourself?
 
Comment #3  (Posted by an unknown user on 09/15/2006)
Rating
There is a fairly detailed explaination, but the example didn't work
 
Comment #4  (Posted by an unknown user on 09/15/2006)
Rating
Excellent work. Thanks.
 
Comment #5  (Posted by an unknown user on 09/29/2006)
Rating
Sounds very interesting...but I can't get it to work. I get an error beginning with..."System.Runtime.InteropServices.COMException (0x8007203A): The server is not operational at...[etc]"

Does anyone know what is needed to make it work?
 
Comment #6  (Posted by an unknown user on 10/02/2006)
Rating
Good One. Concepts are explained very well.
 
Comment #7  (Posted by David on 10/17/2006)
Rating
Nice conceptual level explanation. ought to check the sample.
 
Comment #8  (Posted by Ian Dunn on 07/12/2007)
Rating
After jumping through some hoops to try to get it to compile, I get this exception when trying to do gSession.Logon:

System.Runtime.InteropServices.COMException (0x80040111): [Collaboration Data Objects - [MAPI_E_LOGON_FAILED(80040111)]]

Are there some specific security settings needed for anonymous logon?
 
Comment #9  (Posted by an unknown user on 03/28/2008)
Rating
Can you add another method that will retreive all distribution list name from exhanger server. Adding and removing user to the distribution list.
 
Sponsored Links