none
Distribution List Management using C# RRS feed

  • Question

  • Hi All,

    Is there any way to access the distribution list and manage the members using some C# code. Actually I have to manage the distribution list by providing the member an option to remove himself from the distribution list if he don't want to be. Most of my distribution lists consists of more than 100 people. So its tough for the admin. So I thought of providing a Web page for all my colleagues where all the DL's are listed in which he/she is a member. Is there any built in function or service to trigger the removal of DL group Member???

    Please respond asap.

    Monday, September 15, 2014 5:02 AM

Answers

  • Sabareesh,

    Take a look at the Outlook and Exchange Distribution Lists page which states the following:

    Distribution lists in the Exchange Server GAL are created with the Exchange Administrator program. You can’t create them with the Outlook or Exchange client.

    The administrator can grant access permission to one or more users to maintain the DL; such maintenance is done by opening the DL from the Outlook or Exchange Address Book. However, you can add only addresses that are already in the GAL. This means that it is practical for a user to maintain only lists of internal recipients; each external recipient would have to be added first to the GAL by the administrator.

    Tuesday, September 16, 2014 12:50 PM

All replies

  • You can use the RemoveMembers or RemoveMember methods of the DistListItem class for removing entries.

    You may find the following articles helpful:

    How to: Create a Distribution List

    How to: Get Information About All Distribution Lists of Which the Current User is a Member

    Monday, September 15, 2014 5:28 AM
  • Hi Eugene,

    Can you post a code sample with comments for that. I am not able to get it as I am a beginner. Give an example specific to addition or remove a contact from a distribution list. Thank you so much for your response

    Tuesday, September 16, 2014 6:54 AM
  • Hi Sabareesh,

    The How To: Create a new distribution list item in Outlook article describes the basics and provides a sample code in C#.

    The following VBA code illustrates the way you can use to remove members of the distribution list:

    Sub RemoveRec()  
     'Remove a recipient from the list, and displays new list. 
     
     Dim objDstList As Outlook.DistListItem  
     Dim objName As Outlook.NameSpace  
     Dim objRcpnt As Outlook.Recipient
     Dim objMail As Outlook.MailItem 
     
     Set objName = Application.GetNamespace("MAPI")  
     Set objDstList = objName.GetDefaultFolder(olFolderContacts).Items("Group List")  
     Set objMail = Application.CreateItem(olMailItem) 
     
     Set objRcpnt = objMail.Recipients.Add(Name:="someone@example.com") 
     
     objRcpnt.Resolve 
     
     objDstList.RemoveMember Recipient:=objRcpnt  
     objDstList.Display  
     objDstList.Body = "Last Modified: " & Now  
    End Sub
    

    Tuesday, September 16, 2014 7:48 AM
  • Hi Eugene,

    If I want to remove a person from a Distribution list using the above code do I need to have admin Privileges or anyone who is a member of that dl can remove himself or other person ??

    Tuesday, September 16, 2014 8:37 AM
  • Where is the distribution list is stored?

    As a workaround you can create your own distribution list (for each user).

    Tuesday, September 16, 2014 9:28 AM
  • Exchange server has all the DLs . As the number of people in each DL has became thousands its becoming hectic for the admin of the DL to manage people if they don't want to be part of DL. So we are searching for a programmatical solution where an user can remove himself from the DL list without meeting Admin. Can you give any suggestion on this?

    Tuesday, September 16, 2014 9:51 AM
  • Sabareesh,

    Take a look at the Outlook and Exchange Distribution Lists page which states the following:

    Distribution lists in the Exchange Server GAL are created with the Exchange Administrator program. You can’t create them with the Outlook or Exchange client.

    The administrator can grant access permission to one or more users to maintain the DL; such maintenance is done by opening the DL from the Outlook or Exchange Address Book. However, you can add only addresses that are already in the GAL. This means that it is practical for a user to maintain only lists of internal recipients; each external recipient would have to be added first to the GAL by the administrator.

    Tuesday, September 16, 2014 12:50 PM