DirectorySearcher & sorting

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default DirectorySearcher & sorting

    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

    cameron Guest

  2. Similar Questions and Discussions

    1. Sorting array vs sorting paginated array
      ....pulling in a long list of photos in a gallery, and I have a sort function working within the pages of data fine. I need to bring it back out of...
    2. sorting
      Gary, Please repost WITHOUT the attachment. Many of us use dialup and downloading 1433 lines wastes a lot of our time - especially since very...
    3. DirectorySearcher - SearchResult - User Groups
      Hi, I'm having trouble fetching the AD groups a user belongs to after authenticating them against Active Directory. My code is based on the How To...
    4. Perplexing DirectorySearcher error
      Hi, This seems strange to me and was wondering if anyone had any insight as to why this fails (for users not on the machine) when the ou is...
    5. Sorting in CGI
      Hi, I am writing a form that will list the name in the file namedata.dat in alphabetical order and display in a web page. #!/usr/bin/perl use...
  3. #2

    Default Re: DirectorySearcher & sorting

    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]" <willy.denoyette@skynet.be> wrote in message
    news:ex$jzhlQDHA.560@TK2MSFTNGP10.phx.gbl...
    > This is not possible, Active Directory supports only a single sort key.
    >
    > Willy.
    >
    > "cameron" <cameron.charlebois@appdepot.com> wrote in message
    news:3F05BA20.2070706@appdepot.com...
    > > 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
    > >
    >
    >
    >

    David Waz... Guest

  4. #3

    Default Re: DirectorySearcher & sorting

    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]" <willy.denoyette@skynet.be> wrote in message
    > news:ex$jzhlQDHA.560@TK2MSFTNGP10.phx.gbl...
    >
    >>This is not possible, Active Directory supports only a single sort key.
    >>
    >>Willy.
    >>
    >>"cameron" <cameron.charlebois@appdepot.com> wrote in message
    >
    > news:3F05BA20.2070706@appdepot.com...
    >
    >>>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
    >>>
    >>
    >>
    >>
    >
    >

    cameron Guest

  5. #4

    Default Re: DirectorySearcher & sorting

    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 [url]http://www.dotnet247.com/247reference/msgs/1/9450.aspx[/url].
    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? [url]http://www.gotdotnet.com[/url]
    --------------------
    !Message-ID: <3F05E43E.4050600@appdepot.com>
    !Date: Fri, 04 Jul 2003 14:31:58 -0600
    !From: cameron <cameron.charlebois@appdepot.com>
    !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: <3F05BA20.2070706@appdepot.com>
    <ex$jzhlQDHA.560@TK2MSFTNGP10.phx.gbl>
    <q4lNa.870$Ld6.186@newssvr23.news.prodigy.com>
    !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]" <willy.denoyette@skynet.be> wrote in message
    !> news:ex$jzhlQDHA.560@TK2MSFTNGP10.phx.gbl...
    !>
    !>>This is not possible, Active Directory supports only a single sort key.
    !>>
    !>>Willy.
    !>>
    !>>"cameron" <cameron.charlebois@appdepot.com> wrote in message
    !>
    !> news:3F05BA20.2070706@appdepot.com...
    !>
    !>>>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
    !>>>
    !>>
    !>>
    !>>
    !>
    !>
    !
    !
    !

    Yan-Hong Huang[MSFT] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139