2
votes

We need to remotely create an Exchange 2007 distribution list from Asp.Net.

Near as I can tell, the only way to create a distribution list in the GAL is via the exchange management tools. Without installing this on our web server, is there any way to create a distribution list remotely? There are some third party components that allow you to create personal distribution lists, but these only live in a users Contacts folder and are not available to all users within the company.

Ideally there would be some kind of web services call to exchange or an API we could work with. The Exchange SDK provides the ability to managing Exchange data (e.g. emails, contacts, calendars etc.). There doesn't appear to be an Exchange management API.

It looks like the distribution lists are stored in AD as group objects with a special Exchange attributes, but there doesn't seem to be any documentation on how they are supposed to work.

Edit: We could reverse engineer what Exchange is doing with AD, but my concern is that with the next service pack of Exchange this will all break.

Is there an API that I can use to manage the distribution lists in Active Directory without going through Exchange?

2

2 Answers

1
votes

Look for LDAP.NET, I don't have it handy but I've done it before and it worked well at the time.

Edit: I should add that LDAP is Lightweight Directory Access Protocol.

Also, I can't find LDAP.NET (I got curious and went to look) and now it appears that there's a built-in System.DirectoryServices namespace to do it for you.

http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/729d1214-37f5-4330-9208-bc4d9d695ad0

1
votes

We had a similar problem with mail enabling programatically created public folders and needed to set the msExchHideFromAddressLists property on the exchange system object in active directory...

using (DirectoryEntry LDAPConnection = new DirectoryEntry("LDAP://OURDOMAIN/CN=" + name+ ",CN=Microsoft Exchange System Objects,DC=ourdomain,DC=com"))
{
    LDAPConnection.AuthenticationType = AuthenticationTypes.Secure;
    LDAPConnection.Properties["msExchHideFromAddressLists"].Value = false;
    LDAPConnection.CommitChanges();
}

PS. make sure that any DirectoryEntries are properly disposed of or you'll likely run out of connections before the GC kicks in and end up having to restart the server to clear them.