views:

11

answers:

1

Hello, I have an urgent requirement in MOSS 2007 as below, I want to search/get Computer Names from Active Directory in SharePoint just like search users; Could you please check and help on the same ?

Thank you.

A: 

Assuming you want to retrieve these names programmatically:

As far as I know there is no SharePoint API to retrieve computer names from the AD. Though there are methods on SPUtility to retrieve Users and Groups from the AD. To query computer names you have to implement you own Ldap query:

Use the .Net types System.DirectoryServices.DirectoryEntry / System.DirectoryServices.DirecorySearcher to query against the AD. If you were using .Net 3.5 you could use the types System.DirectoryServices.AccountManagement.ComputerPrincipal and System.DirectoryServices.AccountManagement.PrincipalSearcher to do so.

Jason