DirectoryServices Error: Server doesn't support requested critical extension
I am querying Active Directory to select a list of displaynames and emails. I want to sort the list by displayname, but I am getting the following error:
Server doesn't support requested critical extension
here is my code
VB Code:
DirSearch.Filter = (ConfigurationSettings.AppSettings("AllStaff"))
DirSearch.PropertiesToLoad.Add("member")
DirSearch.Sort.PropertyName = "member"
DirSearch.Sort.Direction = SortDirection.Ascending
[COLOR=darkred]Result = DirSearch.FindOne[/color]
For X = 0 To Result.Properties("member").Count - 1
UserSearch.Filter = ("(" & Left(Result.Properties("member").Item(X), InStr(Result.Properties("member").Item(X), ",") - 1) & ")")
UserSearch.PropertiesToLoad.Add("Mail")
UserSearch.PropertiesToLoad.Add("DisplayName")
UResult = UserSearch.FindOne()
Try
Row = Tbl.NewRow
Row.Item(0) = UResult.Properties("Mail").Item(0)
Row.Item(1) = UResult.Properties("DisplayName").Item(0)
Tbl.Rows.Add(Row)
Catch ExNull As System.NullReferenceException
Catch
Response.Redirect("errorpage.aspx?err=" & Err.Number)
End Try
Next X
The line in dark red is where it errors out. Any ideas why this is happening?
if I remove DirSearch.Sort.PropertyName = "member" from the code it will not error out, but the results will not be sorted.
Ultimately what I need is an alphabetical list of Display Names and Emails.
Thanks for your assistance