For Programmers: Free Programming Magazines  


Home > Archive > C# > June 2004 > adsi and type data set









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author adsi and type data set
rob merritt

2004-06-17, 4:00 pm

Hi

I have some code from a web service I currently return a string. I
would like
to be able to return all info from the ADSI directory searcher in the
form of a typed dataset how would I do this

[WebMethod]
public string SearchStaff(string un)
{
DirectoryEntry entry = new DirectoryEntry("LDAP://ourdomain.ca");
DirectorySearcher src = new
DirectorySearcher("(& (objectCategory=Person)(objectClass=user
)(sAMAccountName="+un+"*)(!(description=Student
at*)))");
string retVal = "";

src.SearchRoot = entry;

src.SearchScope = SearchScope.Subtree;

foreach(SearchResult res in src.FindAll())
{
retVal = retVal + ":" + " {"
+(res.Properties["sAMAccountName"][0]) +"}
"+(res.Properties["Name"][0]);
}
return(retVal);
}
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com