473,396 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

DirectorySearcher - whats wrong with this?!

Hi

I'm getting the following error in my code...

"Exception Details: System.Runtime.InteropServices.COMException: The server
does not support the requested critical extension"

Here's the function...
int listc;
string cs;
DirectoryEntry entry = new DirectoryEntry("LDAP://" +
ConfigurationSettings.AppSettings.Get("System_Acti veDirPath"));
DirectorySearcher mySearcher = new DirectorySearcher(entry);
mySearcher.Filter = ("(objectClass=user)");
mySearcher.Sort = new SortOption("FirstName", SortDirection.Ascending);
listc = 1;
foreach(SearchResult resEnt in mySearcher.FindAll())
{
try
{
DirectoryEntry de = resEnt.GetDirectoryEntry();
if((de.Properties["DisplayName"].Value != null) &&
(de.Properties["givenName"].Value != null) && (de.Properties["sn"].Value !=
null))
{
ListItem adItem = new ListItem();
adItem.Text = de.Properties["givenName"].Value.ToString() + " " +
de.Properties["sn"].Value.ToString();
adItem.Value = de.Properties["sAMaccountname"].Value.ToString();
ddlDartsContact.Items.Insert(listc, adItem);
adItem = null;
listc++;
}
}
finally {}

I *think* the problem is to do with the line

mySearcher.Sort = new SortOption("FirstName", SortDirection.Ascending);

Any help/ideas as to what's wrong appreciated!

Cheers
Dan

Nov 19 '05 #1
2 3258
Hi Dan:

I know there is some sort operations that can cause this error (see
http://support.microsoft.com/?kbid=842637). As the article suggests -
you could sort the entries client side.

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Mon, 21 Mar 2005 03:35:05 -0800, dhnriverside <da*@musoswire.com>
wrote:
Hi

I'm getting the following error in my code...

"Exception Details: System.Runtime.InteropServices.COMException: The server
does not support the requested critical extension"

Here's the function...
int listc;
string cs;
DirectoryEntry entry = new DirectoryEntry("LDAP://" +
ConfigurationSettings.AppSettings.Get("System_Act iveDirPath"));
DirectorySearcher mySearcher = new DirectorySearcher(entry);
mySearcher.Filter = ("(objectClass=user)");
mySearcher.Sort = new SortOption("FirstName", SortDirection.Ascending);
listc = 1;
foreach(SearchResult resEnt in mySearcher.FindAll())
{
try
{
DirectoryEntry de = resEnt.GetDirectoryEntry();
if((de.Properties["DisplayName"].Value != null) &&
(de.Properties["givenName"].Value != null) && (de.Properties["sn"].Value !=
null))
{
ListItem adItem = new ListItem();
adItem.Text = de.Properties["givenName"].Value.ToString() + " " +
de.Properties["sn"].Value.ToString();
adItem.Value = de.Properties["sAMaccountname"].Value.ToString();
ddlDartsContact.Items.Insert(listc, adItem);
adItem = null;
listc++;
}
}
finally {}

I *think* the problem is to do with the line

mySearcher.Sort = new SortOption("FirstName", SortDirection.Ascending);

Any help/ideas as to what's wrong appreciated!

Cheers
Dan


Nov 19 '05 #2
Are you sure that there is an attribute called FirstName in the user class?
It is usually called givenName

"dhnriverside" <da*@musoswire.com> wrote in message
news:71**********************************@microsof t.com...
Hi

I'm getting the following error in my code...

"Exception Details: System.Runtime.InteropServices.COMException: The server does not support the requested critical extension"

Here's the function...
int listc;
string cs;
DirectoryEntry entry = new DirectoryEntry("LDAP://" +
ConfigurationSettings.AppSettings.Get("System_Acti veDirPath"));
DirectorySearcher mySearcher = new DirectorySearcher(entry);
mySearcher.Filter = ("(objectClass=user)");
mySearcher.Sort = new SortOption("FirstName", SortDirection.Ascending);
listc = 1;
foreach(SearchResult resEnt in mySearcher.FindAll())
{
try
{
DirectoryEntry de = resEnt.GetDirectoryEntry();
if((de.Properties["DisplayName"].Value != null) &&
(de.Properties["givenName"].Value != null) && (de.Properties["sn"].Value != null))
{
ListItem adItem = new ListItem();
adItem.Text = de.Properties["givenName"].Value.ToString() + " " +
de.Properties["sn"].Value.ToString();
adItem.Value = de.Properties["sAMaccountname"].Value.ToString();
ddlDartsContact.Items.Insert(listc, adItem);
adItem = null;
listc++;
}
}
finally {}

I *think* the problem is to do with the line

mySearcher.Sort = new SortOption("FirstName", SortDirection.Ascending);

Any help/ideas as to what's wrong appreciated!

Cheers
Dan

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: jeje91 | last post by:
I need to get a directoryentry associated to a samaccountname. It works in most cases, except when there are special characters in the samaccountname. In the present case, a user has a '(' char...
4
by: cameron | last post by:
I have always been under the impression that LDAP was optimized for speed. Fast queries, fast access, slower writes. I have a block of data in LDAP and in SQL. Exact same data. The query is fast...
0
by: jeje91 | last post by:
I need to get a directoryentry associated to a samaccountname. It works in most cases, except when there are special characters in the samaccountname. In the present case, a user has a '(' char...
2
by: Jim in Arizona | last post by:
I'm trying to do a check to see if a specific active directory user account exists in active directory AND a specific group. I can't seem to get the filter down right. I can do this to find a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.