Export Personal Distribution List to CSV

We recently had a secretary who created a personal distribution list (PDL) with too many members.

This is a limitation of distribution lists that are created and stored in a Microsoft Exchange Server mailbox store or in a personal folders (.pst) file. There is no definite limit to the number of contacts that you can add to a distribution list.

In her case, she could no longer edit the list since it became too big. We found she could use OWA to open the DL, but still could not update it. Nice thing, is that OWA uses XML to display the PDL. Using a little PowerShell magic, I was able to dump that list into a CSV, so she could recreate the lists.

  1. Open PDL in OWA.
  2. Right click the window and select View Source on the popup window. Scroll down near the bottom, you'll find the XML section containing all the entries. Copy everything between < XML ID="MemberList" to the first /XML.
     
    < xml id="memberlist> (blah blah blah) < /xml>
  3. Open PowerShell!
  4. Create a variable that equals this XML code. I enclosed the data inside single quotes. Use the [xml] prefix to set the data type on the variable. Note you may need to remove single quotes from any names, I had an O'Connor.
    [XML] $Contacts = '< xml id="memberlist"> (blah blah blah) < /xml>'</code> </li>
    <li>Now just crusie the XML structure:
    <code>
    $contacts.xml.cdldata.member | select dn, email | Export-Csv -path c:\My-ContactList.csv
    </code></li>
    </ol>

    If you've got the right XML code from the web page, you should now have a CSV containing all the display names (DN) and the smtp email address from this PDL.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <blockquote> <center> <hr> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <drupal6>, <html>, <java>, <javascript>, <php>, <posh>.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.