DirectorySearcher cannot Sort
ASP.NET
1
Posts
1
Posters
0
Views
1
Watching
-
Hi all, I'm having a problem sorting my results from DirectorySearcher. Here's the code:
DirectorySearcher searcher = new DirectorySearcher(new DirectoryEntry("xxx"));
searcher.PropertiesToLoad.AddRange(new string[]{"f1","f2"});
searcher.Filter = "(f2=value)";
searcher.Sort = new SortOption("f1",SortDirection.Ascending);
SearchResultCollection res = searcher.FindAll(); <-- throw exceptionUp to the last line an exception will be thrown stating: "The value for the property Sort could not be set.". Could someone please give a hand on this? I'm using VS .NET v1.1.4, would it be because this version doesn't support Sort for DirectorySearcher? Thanks all, Anzy