views:

193

answers:

4

Hello,

I'm trying to build a .Net application to interrogate Active Directory.

Edit: I need to use a Web Service to do this as I will be talking to AD from a Sharepoint Workflow using a third party workflow tool that requires the use of a web service.

From my research, Windows 2008 R2 has Active Directory Web Services (ADWS) built in.

I can't find any details or examples anywhere on the web which tell me whether I should be able to use ADWS in a .Net application to read/write AD information.

Should I simply be able to add a web reference or is ADWS just for Powershell use.

Cheers,

Iain

+1  A: 

If you need to query against AD, you can use .NET built insupport for querying Active Directory using either LDAP or ADSI.

The System.DirectoryServices namespace in .NET has all the tools you need to succesfully query, and manage AD objects.

The work flow is as follows:

  1. Create a DirectorySearcher Object
  2. Bind against your Active Directory (ie supply credentials)
  3. Create a search query filter
  4. Set any query parameters
  5. Execute the query
  6. Iterate over the result set
Alan
While your answer is technically correct, it doesn't answer the OP's question, which is how (or can) he use the webservices.
slugster
This line "I'm trying to build a .Net application to interrogate Active Directory." indicated that the OP wants to interrogate AD. The way to interrogate AD is through ADSI or LDAP.
Alan
slugster is correct. I know I can use .Net to directly interrogate AD. I need to use a Web service to do it. Now I can either write my own web service (yes I know how to do that thank you), or I can use one that Microsoft already provide. Hence my question. So your answer is useless to me thanks all the same.
Iain Carlin
A: 

If you're on .NET 3.5 you could use the direct access to AD - with 3.5, the story has been vastly improved.

The new System.DirectoryServices.AccountManagement namespace makes a lot of user- and group-related operations a lot easier than they were before.

Check out the MSDN article Managing Directory Security Principals in the .NET Framework 3.5 for an excellent intro to the topic.

It's not ADWS - but maybe it just as well fits your bill.

marc_s
My question is not about how I can use AccountManagment namespace. I know I can do that if I need to. My question is can I use the existing ADWS rather than rolling my own web service.
Iain Carlin
+1  A: 

Did you ever get an answer to this about using ADWS

Robbo
Hi Robbo, yes I ended up posting on a the Micrsoft AD Development forum. The answer I got was "Yes, what you want to do is possible but at this stage it's undocumented so you're on your own....". (http://social.technet.microsoft.com/Forums/en-US/winserverDS/thread/ec2ff410-25ed-46f7-95e0-18b639935907)I have ended up writing my own web service using the standard System.DirectoryServices classes.
Iain Carlin
A: 

Looks like they created ADWS for PowerShell's ActiveDirectory module and Active Directory Administrative Center only. Though it seems possible to consume it directly due to it's WCF nature. But no, there's not even a single article on MSDN or a blog post out there on the net about this topic.

Parsa