Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > DirectorySearcher & sorting

Reply
Thread Tools

DirectorySearcher & sorting

 
 
cameron
Guest
Posts: n/a
 
      07-04-2003
I would like to do a search and have the results sorted by property 1
and then by property 2. My first thought had been

//set up the searching object and call it oSearch
oSearch.Sort.PropertyName = "Property1,Proptery2";

but that was unhappy. I can do a
oSearch.Sort.PropertyName = "Property1";
or
oSearch.Sort.PropertyName = "Property2";
without issue but I can not figure out how to do what I need. I took a
look at the System.DirectoryServices.SortOption and it doesn't seem to
do anything new either. I am dealing with a fairly large result set so I
REALLY do not want to have to do a sort myself after I get the results.

Thanks.

-Cam

 
Reply With Quote
 
 
 
 
David Waz...
Guest
Posts: n/a
 
      07-04-2003
If you move the content into a DataTable, your first method would work.
o_Table.DefaultView.SortExpression="Prop1, Prop2"

Then use the datatable as the source of your data.



"Willy Denoyette [MVP]" <(E-Mail Removed)> wrote in message
news:ex$(E-Mail Removed)...
> This is not possible, Active Directory supports only a single sort key.
>
> Willy.
>
> "cameron" <(E-Mail Removed)> wrote in message

news:(E-Mail Removed)...
> > I would like to do a search and have the results sorted by property 1
> > and then by property 2. My first thought had been
> >
> > //set up the searching object and call it oSearch
> > oSearch.Sort.PropertyName = "Property1,Proptery2";
> >
> > but that was unhappy. I can do a
> > oSearch.Sort.PropertyName = "Property1";
> > or
> > oSearch.Sort.PropertyName = "Property2";
> > without issue but I can not figure out how to do what I need. I took a
> > look at the System.DirectoryServices.SortOption and it doesn't seem to
> > do anything new either. I am dealing with a fairly large result set so I
> > REALLY do not want to have to do a sort myself after I get the results.
> >
> > Thanks.
> >
> > -Cam
> >

>
>
>



 
Reply With Quote
 
 
 
 
cameron
Guest
Posts: n/a
 
      07-04-2003
Move the content? Copy the actual data from AD to a SQL table? Wouldn't
that be nasty expensive to do whenever I needed to search? Or is there a
way to access the underlaying Database object?

-Cam

David Waz... wrote:
> If you move the content into a DataTable, your first method would work.
> o_Table.DefaultView.SortExpression="Prop1, Prop2"
>
> Then use the datatable as the source of your data.
>
>
>
> "Willy Denoyette [MVP]" <(E-Mail Removed)> wrote in message
> news:ex$(E-Mail Removed)...
>
>>This is not possible, Active Directory supports only a single sort key.
>>
>>Willy.
>>
>>"cameron" <(E-Mail Removed)> wrote in message

>
> news:(E-Mail Removed)...
>
>>>I would like to do a search and have the results sorted by property 1
>>>and then by property 2. My first thought had been
>>>
>>>//set up the searching object and call it oSearch
>>>oSearch.Sort.PropertyName = "Property1,Proptery2";
>>>
>>>but that was unhappy. I can do a
>>>oSearch.Sort.PropertyName = "Property1";
>>>or
>>>oSearch.Sort.PropertyName = "Property2";
>>>without issue but I can not figure out how to do what I need. I took a
>>>look at the System.DirectoryServices.SortOption and it doesn't seem to
>>>do anything new either. I am dealing with a fairly large result set so I
>>>REALLY do not want to have to do a sort myself after I get the results.
>>>
>>>Thanks.
>>>
>>>-Cam
>>>

>>
>>
>>

>
>



 
Reply With Quote
 
Yan-Hong Huang[MSFT]
Guest
Posts: n/a
 
      07-07-2003
Hello Cam,

There is no need to copy all the AD data to SQL table? What we need to do
is to see whether it is possible to copy the search result into a dataset.

Please refer to http://www.dotnet247.com/247reference/msgs/1/9450.aspx.
Hope it helps.

Best regards,
yhhuang
VS.NET, Visual C++
Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net? http://www.gotdotnet.com
--------------------
!Message-ID: <(E-Mail Removed)>
!Date: Fri, 04 Jul 2003 14:31:58 -0600
!From: cameron <(E-Mail Removed)>
!User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.0)
Gecko/20020530
!X-Accept-Language: en-us, en
!MIME-Version: 1.0
!Subject: Re: DirectorySearcher & sorting
!References: <(E-Mail Removed)>
<ex$(E-Mail Removed)>
<q4lNa.870$(E-Mail Removed)>
!Content-Type: text/plain; charset=us-ascii; format=flowed
!Content-Transfer-Encoding: 7bit
!Newsgroups:
microsoft.public.dotnet.languages.csharp,microsoft .public.dotnet.framework.a
spnet
!NNTP-Posting-Host: hssxrg64-201-211-159.sasknet.sk.ca 64.201.211.159
!Lines: 1
!Path: cpmsftngxa09.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
!Xref: cpmsftngxa09.phx.gbl microsoft.public.dotnet.framework.aspnet:32353
microsoft.public.dotnet.languages.csharp:30649
!X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
!
!Move the content? Copy the actual data from AD to a SQL table? Wouldn't
!that be nasty expensive to do whenever I needed to search? Or is there a
!way to access the underlaying Database object?
!
!-Cam
!
!David Waz... wrote:
!> If you move the content into a DataTable, your first method would work.
!> o_Table.DefaultView.SortExpression="Prop1, Prop2"
!>
!> Then use the datatable as the source of your data.
!>
!>
!>
!> "Willy Denoyette [MVP]" <(E-Mail Removed)> wrote in message
!> news:ex$(E-Mail Removed)...
!>
!>>This is not possible, Active Directory supports only a single sort key.
!>>
!>>Willy.
!>>
!>>"cameron" <(E-Mail Removed)> wrote in message
!>
!> news:(E-Mail Removed)...
!>
!>>>I would like to do a search and have the results sorted by property 1
!>>>and then by property 2. My first thought had been
!>>>
!>>>//set up the searching object and call it oSearch
!>>>oSearch.Sort.PropertyName = "Property1,Proptery2";
!>>>
!>>>but that was unhappy. I can do a
!>>>oSearch.Sort.PropertyName = "Property1";
!>>>or
!>>>oSearch.Sort.PropertyName = "Property2";
!>>>without issue but I can not figure out how to do what I need. I took a
!>>>look at the System.DirectoryServices.SortOption and it doesn't seem to
!>>>do anything new either. I am dealing with a fairly large result set so I
!>>>REALLY do not want to have to do a sort myself after I get the results.
!>>>
!>>>Thanks.
!>>>
!>>>-Cam
!>>>
!>>
!>>
!>>
!>
!>
!
!
!

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DirectorySearcher first access speed cameron ASP .Net 6 11-26-2004 06:39 AM
DirectorySearcher Filter Exchange Server Roger Bavaud ASP .Net 1 11-05-2004 01:32 AM
DirectorySearcher.FindAll() =?Utf-8?B?QW5kcmV3MTI0?= ASP .Net 0 07-11-2004 09:19 PM
Parameter in a directorysearcher.filter? Jay ASP .Net 1 04-15-2004 03:24 PM
DirectoryServices.DirectorySearcher dave ASP .Net 0 12-16-2003 06:34 PM



Advertisments