How do I create a Distribution List in a Public Folder using the EWS Managed API RRS feed

  • Question

  • Hi all,
    I have a public folder the stores contacts and distribution lists for our organisation. I'm trying to run the following code:

    //Create the Group


    ContactGroup group = new ContactGroup(service);
    group.DisplayName =

    When running the code I get the error: "The property Members is only valid for Exchange version Exchange2010 or later." I am running Exchange 2007 SP1. Is there any way to create a distribution list in a public folder using the EWS Managed API?? What if I upgrade to Exchange 2007 SP2, will that make any difference?

    Thanks in advance,
    Monday, January 25, 2010 3:26 AM

All replies

  • Anyone??

    Wednesday, January 27, 2010 12:09 AM
  • Unfortunately, full support for distribution lists (creation, add/remove members) was introduced in Exchange 2010. Against Exchange 2007 SP1 or SP2, you cannot do any of the following:
    - Create a new DL,
    - Retrieve the members of an existing DL (you can however use ExchangeService.ExpandGroup instead),
    - Modify the members of an existing DL.

    Your best alternative is WebDAV.

    David Claux | Program Manager - Exchange Web Services
    Wednesday, January 27, 2010 4:35 PM
  • For the many people out there, this is entirely possible with Exchange2007 SP1 and though I haven't verified, I'm sure SP2 would work as well.
    The biggest advantage with WebServices is that you don't need Outlook installed on the computer running the code, unlike using the Microsoft.Office.Interop.Outlook namespace.  This can be extremely important in a production environment.

    You can do most CRUD operations to a distribution list, though I was unable to get the viewing of members of an Outlook Distribution List to work, which is funny as this is really the only provided distribution list functionality in the Service, and it doesn't appear to work, basically because Outlook Distribution Lists don't have a SMTP address???  I admit I question where they're going with this Web Service, as it's definitely not easy or even remotely straight forward to use.

    The trick to the distribution lists is to assign the correct Extended Properties, there are 5 special to a distribution list; 3 of them contain the Distribution List Name while the other 2 are responsible for the members of the list.  One thing not readily apparent is that you can pass OneOffMembers to the Members list, this will allow you to add external email addresses instead of existing GAL contacts, because lets face it, why else would you use an Outlook Distribution List over an AD Distribution List?  There are quite a few examples out there, though none of which actually work right off the bat, and most aren't even worth using in the provided context, but they will lead you to working code.  Keep working on it!

    Here's a decent link -->;#bdc451adc0251893
    Wednesday, May 25, 2011 9:03 PM