views:

301

answers:

1

Is there a .NET library for LDAP paths manipulations?
I would like to have something equivalent to System.IO.Path, allowing e.g. to do something like

string ou1 = LDAPPath.Combine("OU=users","DC=x,DC=y");
string ou2 = LDAPPath.Parent("CN=someone,OU=users,DC=x,DC=y");

Otherwise, what's the common way to deal with LDAP distinguished names in .NET?

To clarify my question: I'm not asking about "directory services in .NET" in general; I've already worked with that and done some programs to perform some tasks. What I feel is missing is a proper way to manipulate paths, parse distinguished names and so on, and since this should be a pretty common need, I hope there's a cleaner way to do this than split a string on commas(1).

(1) like, for example, calling a function in a library that splits the string on commas

+1  A: 

No, not to my knowledge - not even in the most recent .NET 3.5 namespace for Active Directory.

You can navigate the hierarchy (going to the parent etc.) in the directory itself - but you need to be bound to e.g. Active Directory by means of a DirectoryEntry.

And then there's the NameTranslate API, but that's really more of a "change this name to another name", e.g. change from user-principal name to relative DN - and again, it requires a connection to a DirectoryEntry in AD.

I would be most interested in finding such a library, but so far, I haven't heard about one - neither in .NET nor in any other language, really.

Back in my "heavy-duty" AD programming days, I had my own set of LDAP path manipulation routines (in Delphi) - basically just string parsing and handling.

Marc

marc_s
Hi marc_s, thanks for your answer... that's more or less what I guessed.
Paolo Tedesco