Re: browsing AD with asp.net
- From: "cgian31" <cgian31@xxxxxxxxxxxx>
- Date: 27 Jan 2006 05:54:03 -0800
I instantiated DirectoryEntry this way:
DirectoryEntry de=new
DirectoryEntry(LDAP://<my.organization.extension>/DC=<my>,DC=<organization>,DC=<extension>,
<domain\userid>, <domain password>);
Pls. note that <domain\userid> is my domain user, which works in the
console application.
After that:
irectorySearcher searcher = new DirectorySearcher(de);
string sFilter = "(&(objectCategory=person)(objectClass=user))";
searcher.Filter = sFilter;
searcher.SearchScope = System.DirectoryServices.SearchScope.Subtree;
SearchResultCollection results = searcher.FindAll();
which works great and I retrieve a list of users.
But now for each user I want other details, therefore I do this, for
example to get LastLogin, because it is easier than using
SirectoryEntry:
string lastlog;
ActiveDs.IADsUser IADsDe = (ActiveDs.IADsUser) UE.NativeObject;
lastlog=IADsDe.LastLogin.ToString("yyyy-MM-dd hh:mm");
Which gives the COMException.
I have seen I can get the properties and their values via the
DirectoryEntry, but it is a bit of a hassle, since they are a bit
messy.
But I will do it that way.
Thanks for your time and help!
.
- Follow-Ups:
- Re: browsing AD with asp.net
- From: Joe Kaplan \(MVP - ADSI\)
- Re: browsing AD with asp.net
- From: cgian31
- Re: browsing AD with asp.net
- References:
- browsing AD with asp.net
- From: cgian31
- Re: browsing AD with asp.net
- From: Joe Kaplan \(MVP - ADSI\)
- Re: browsing AD with asp.net
- From: cgian31
- Re: browsing AD with asp.net
- From: Joe Kaplan \(MVP - ADSI\)
- Re: browsing AD with asp.net
- From: cgian31
- Re: browsing AD with asp.net
- From: Joe Kaplan \(MVP - ADSI\)
- browsing AD with asp.net
- Prev by Date: certificate of type DomainController has failed
- Next by Date: Re: browsing AD with asp.net
- Previous by thread: Re: browsing AD with asp.net
- Next by thread: Re: browsing AD with asp.net
- Index(es):