InfiniTec - Henning Krauses Blog

Don't adjust your mind - it's reality that is malfunctioning

Manage distributionlists programatically


When examined via WebDAV, distribution lists are stored as items of type urn :content -classes:group. The Outlook message class ( is IPM.DistList.
The information about the members of the distribution list is stored in the field This is a multivalued field of type mv.base64. Unfortunately, this field is not documented by Microsoft.
But, as pointed out in the summary, user can manage their distribution lists via Outlook Web Access. So, one way to programatically manage distribution lists is to simulate an Outlook Web Access client. This method is used in this article.


To get the contents of a distribution list, make a GET request to the URL of the distribution list with the query-string set to Cmd=viewmembers. The User-Agent header must be set to Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322) so that the Exchange ISAPI filter knows the client can handle an xml response.
The response will look like this:

    1 <xml id="memberlist">

    2   <cdldata>

    3     <href>

    4       <!--Uri to distribution list -->

    5     </href>

    6     <error></error>

    7     <membertext></membertext>

    8     <unresolvedcount>0</unresolvedcount>

    9     <member>

   10       <memberid>0</memberid>

   11       <icon>/exchweb/img/icon-1off.gif</icon>

   12       <dn></dn>

   13       <email></email>

   14     </member>

   15     <member>

   16       <memberid>1</memberid>

   17       <icon>/exchweb/img/icon-member.gif</icon>

   18       <dn>Administrator</dn>

   19       <email>Administrator@contoso.local</email>

   20     </member>

   21   </cdldata>

   22 </xml>

The member is is espacially important when removing members from a distribution list, because it must be passed along with the request.

To add a new member to a distritubion list, make a POST request to the URL of the list and specify this body within the request:

    1 Cmd=addmember

    2 msgclass=IPM.DistList


Again, the User-Agent field must be set to the value mentioned above.

On success, you will receive a HTTP/1.1 302 Moved Temporarily message that point to the url of the list with the querystring set to Cmd = viewmembers.

To remove a member from the list, make a POST request with the following body within the request:

    1 Cmd=deletemember

    2 msgclass=IPM.DistList

    3 memberid=1

Be sure to set the member id to the id of the entry you want to remove. When successful, you will receive the same response as above.


Posted by Henning Krause on Friday, December 31, 2004 12:00 AM, last modified on Monday, December 26, 2005 12:00 PM
Permalink | Post RSSRSS comment feed