|
-
Dec 4th, 2003, 09:09 AM
#1
Thread Starter
Lively Member
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
Jason Meckley
Database Analyst
WITF
-
Dec 4th, 2003, 09:44 AM
#2
Thread Starter
Lively Member
I found a work around, while it's not the most elegant, it works.
I load the member attribute into an ArrayList object and then sort the list.
VB Code:
DirSearch.Filter = (ConfigurationSettings.AppSettings("AllStaff"))
DirSearch.PropertiesToLoad.Add("member")
Result = DirSearch.FindOne
For X = 0 To Result.Properties("member").Count - 1
Member.Add(Left(Result.Properties("member").Item(X), InStr(Result.Properties("member").Item(X), ",") - 1))
Next
Member.Sort()
For X = 0 To Member.Count - 1
UserSearch.Filter = ("(" & Member.Item(X) & ")")
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
'do nothing
Catch
Response.Redirect("errorpage.aspx?err=" & Err.Number)
End Try
Next
Jason Meckley
Database Analyst
WITF
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|