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.16883116883114 out of 5
 77 people have rated this page
Article Score38040
Sponsored Links