Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. please delete thread....

please delete thread....

Scheduled Pinned Locked Moved C#
helpcom
21 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S shwaguy

    I seem to get my feathers up when people reply, with the first thought that comes into their head, without actually reading the original post; it tends to destroy a thread. Your post was not so bad, simple mistake...but 2 replies in a row (one not yours) that went down the same path is a bit frustrating. Usually when a thread gets to 2 like this I never get an answer to the question......so I will ask later. thanks shwaguy

    N Offline
    N Offline
    Not Active
    wrote on last edited by
    #10

    shwaguy wrote:

    so I will ask later.

    I'll remember to ignore you then.


    only two letters away from being an asset

    S 1 Reply Last reply
    0
    • K KaptinKrunch

      I did a little more testing for you. The reason the result is null is because AD does not contain an entry for the userName provided. Try using a different username for the userName variable. Confirmed here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sds/sds/directoryservices_directorysearcher_findone.asp[^] If more than one entry is found during the search, only the first entry is returned. If no entries are found to match the search criteria, a null reference (Nothing in Visual Basic) is returned.

      Just because we can; does not mean we should.

      S Offline
      S Offline
      shwaguy
      wrote on last edited by
      #11

      Thanks, but the userName is valid, it was the first thing I checked: The variable (and query) I used for the search filter worked fine with "FindAll()" The thread is closed now....thanks for the help.

      1 Reply Last reply
      0
      • S shwaguy

        After 3 hours of frustration I need some help with the findOne() method. FindAll() is no problem but after gong through and trying findOne() code I have only gotten one to work all the others fail (including the one on this site: http://www.codeproject.com/KB/system/QueryADwithDotNet.aspx[^]. The problem seems to be with the search filter, I have to set it to "samaccountname": DirectorySearcher search = new DirectorySearcher(); //this filter works search.Filter = "samaccountname=" + userName; //This below formats for the search filter result in result=null //search.Filter = String.Format("(cn={0})", userName); //code project filter //search.Filter = "cn=" + userName; search.PropertiesToLoad.Add("memberOf"); StringBuilder groupsList = new StringBuilder(); SearchResult result = search.FindOne(); if (result != null) { int groupCount = result.Properties["memberOf"].Count; for (int counter = 0; counter < groupCount; counter++) { groupsList.Append((string)result.Properties["memberOf"][counter]); groupsList.Append("|"); } } else { MessageBox.Show("not found"); } help!!! shwaguy

        modified on Friday, December 28, 2007 12:37:58 PM

        P Offline
        P Offline
        Paul Conrad
        wrote on last edited by
        #12

        It is proper to keep a thread even if you already found the solution. Someone later on might have the same type of problem and this thread could help them.

        "The clue train passed his station without stopping." - John Simmons / outlaw programmer

        S 1 Reply Last reply
        0
        • P Paul Conrad

          It is proper to keep a thread even if you already found the solution. Someone later on might have the same type of problem and this thread could help them.

          "The clue train passed his station without stopping." - John Simmons / outlaw programmer

          S Offline
          S Offline
          shwaguy
          wrote on last edited by
          #13

          Hi Paul, I agree. In this case no solution was found for the original question and the thread turned into an unreadable mess that would only serve to waste the time of someone seeking a solution. Usually, I get good or great responses from this forum. People usually read, think then answer (even if the correct solution is not given). Maybe I just asked on a bad day. shwaguy

          N P 2 Replies Last reply
          0
          • S shwaguy

            Hi Paul, I agree. In this case no solution was found for the original question and the thread turned into an unreadable mess that would only serve to waste the time of someone seeking a solution. Usually, I get good or great responses from this forum. People usually read, think then answer (even if the correct solution is not given). Maybe I just asked on a bad day. shwaguy

            N Offline
            N Offline
            Not Active
            wrote on last edited by
            #14

            shwaguy wrote:

            Maybe I just asked on a bad day.

            Or, more likely, you asked a poorly defined question and are now upset and pouting. :((


            only two letters away from being an asset

            S 1 Reply Last reply
            0
            • N Not Active

              shwaguy wrote:

              so I will ask later.

              I'll remember to ignore you then.


              only two letters away from being an asset

              S Offline
              S Offline
              shwaguy
              wrote on last edited by
              #15

              thanks for letting me know you will ignore my threads...it was very useful on topic information (sc). I understand that people make mistakes, but, when I get 3 knee jerk responses (responses that have NO input to the question) in a row I tend to figure noone will want to read the thread. I twice stated that there was no issue with the existing code, but, you seemed to miss that. Your ego must be easily bruised if to be hurt by those exclamation marks. -If a response is not the solution thats all good. -If a response is correct solution thats all good. -If the response is off topic becuase the poster did not bother to read the post....I think "I wish that the poster could delete the response, its a waste of reading time and clutters the original post" You take offense way too easily. Just because you have 3500 posts does not mean I am kissing your butt for very poor, of topic, replies. I don't have anything against you either, I think you may have helped a lot of threads. shwaguy

              N 1 Reply Last reply
              0
              • N Not Active

                shwaguy wrote:

                Maybe I just asked on a bad day.

                Or, more likely, you asked a poorly defined question and are now upset and pouting. :((


                only two letters away from being an asset

                S Offline
                S Offline
                shwaguy
                wrote on last edited by
                #16

                beatit fool....read the code comments of my original code and the posting. Your wrong, stop flaming. I am starting to think taht a large portion of your 3500 posts were garbage posts.

                1 Reply Last reply
                0
                • S shwaguy

                  Hi Paul, I agree. In this case no solution was found for the original question and the thread turned into an unreadable mess that would only serve to waste the time of someone seeking a solution. Usually, I get good or great responses from this forum. People usually read, think then answer (even if the correct solution is not given). Maybe I just asked on a bad day. shwaguy

                  P Offline
                  P Offline
                  Paul Conrad
                  wrote on last edited by
                  #17

                  shwaguy wrote:

                  the original question

                  It did sound rather vague.

                  "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

                  S 1 Reply Last reply
                  0
                  • S shwaguy

                    thanks for letting me know you will ignore my threads...it was very useful on topic information (sc). I understand that people make mistakes, but, when I get 3 knee jerk responses (responses that have NO input to the question) in a row I tend to figure noone will want to read the thread. I twice stated that there was no issue with the existing code, but, you seemed to miss that. Your ego must be easily bruised if to be hurt by those exclamation marks. -If a response is not the solution thats all good. -If a response is correct solution thats all good. -If the response is off topic becuase the poster did not bother to read the post....I think "I wish that the poster could delete the response, its a waste of reading time and clutters the original post" You take offense way too easily. Just because you have 3500 posts does not mean I am kissing your butt for very poor, of topic, replies. I don't have anything against you either, I think you may have helped a lot of threads. shwaguy

                    N Offline
                    N Offline
                    Not Active
                    wrote on last edited by
                    #18

                    :laugh: :laugh: :laugh:

                    shwaguy wrote:

                    I twice stated that there was no issue with the existing code,

                    Then why did you post it? Go away, son, you bore me.


                    only two letters away from being an asset

                    S 1 Reply Last reply
                    0
                    • P Paul Conrad

                      shwaguy wrote:

                      the original question

                      It did sound rather vague.

                      "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

                      S Offline
                      S Offline
                      shwaguy
                      wrote on last edited by
                      #19

                      Putting aside the 2 replies I got being totally off topic: - "what error message did you get?" - uh...none...I got a null value as stated. - replace code that was stated as working search.Filter = "samaccountname=" + userName; with this other filter that works equally well too (blah, blah, blah). Whats vague about the post?: //this filter works search.Filter = "samaccountname=" + userName; //This below formats for the search filter result in result=null //search.Filter = String.Format("(cn={0})", userName); //code project filter //search.Filter = "cn=" + userName; SearchResult result = search.FindOne(); shwaguy

                      P 1 Reply Last reply
                      0
                      • N Not Active

                        :laugh: :laugh: :laugh:

                        shwaguy wrote:

                        I twice stated that there was no issue with the existing code,

                        Then why did you post it? Go away, son, you bore me.


                        only two letters away from being an asset

                        S Offline
                        S Offline
                        shwaguy
                        wrote on last edited by
                        #20

                        You just have to feel like your right on this don't you? Here is the news, you are wrong again. The code although correct did not suit my purpose. If you bothered to read the posting you would have noted that I commented out (with comments) the items that would not work, but wanted to work. as previously stated: beat it.

                        1 Reply Last reply
                        0
                        • S shwaguy

                          Putting aside the 2 replies I got being totally off topic: - "what error message did you get?" - uh...none...I got a null value as stated. - replace code that was stated as working search.Filter = "samaccountname=" + userName; with this other filter that works equally well too (blah, blah, blah). Whats vague about the post?: //this filter works search.Filter = "samaccountname=" + userName; //This below formats for the search filter result in result=null //search.Filter = String.Format("(cn={0})", userName); //code project filter //search.Filter = "cn=" + userName; SearchResult result = search.FindOne(); shwaguy

                          P Offline
                          P Offline
                          Paul Conrad
                          wrote on last edited by
                          #21

                          The original post was rather vague. Not the ones that followed.

                          "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups