Results 1 to 3 of 3

Thread: [RESOLVED] Looping Through the DirectoryEntry.Children Objects Doesn't Pull All Attribute Names

  1. #1

    Thread Starter
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Resolved [RESOLVED] Looping Through the DirectoryEntry.Children Objects Doesn't Pull All Attribute Names

    In my loop, I'm adding the property name and the value to a custom class.

    C# Code:
    1. foreach (PropertyValueCollection p in ChildObject.Properties)
    2.                                 {
    3.                                     ActiveDirectoryAttributeList ADAList = new ActiveDirectoryAttributeList();
    4.                                     ADAList.Attribute = p.PropertyName;
    5.                                     ADAList.AttributeValue = p.Value.ToString();
    6.                                     ChildNode.Attributes.Add(ADAList);
    7.                                 }


    I'm able to pull some attributes, but not all of them. Below is an example of what my app pulls and what ADSI Edit pulls.

    ADSI Edit:



    My app:



    Any ideas on why it's not pulling everything?
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Looping Through the DirectoryEntry.Children Objects Doesn't Pull All Attribute Na

    It is... and it isn't... it's pulling the data that IS there... the attributes that ARE set... I'm thinking that ADSI Edit knows there are other possible attributes on the selected node... but they are not set.
    It's like in XML, if you know the schema, you know what to expect... so you know what attributes/whatever are not set... even though the data itself may only have 3 of the 6 attributes set...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Looping Through the DirectoryEntry.Children Objects Doesn't Pull All Attribute Na

    How are you doing your initial search? I've had several occasions where I've needed to explicitly specify a property I'm searching for when accessing our LDAP server.

    When using a DirectorySearcher, you can do

    Code:
    DirectorySearcher search = new DirectorySearcher(<DirectoryEntry object>);
    search.PropertiesToLoad.Add("keythatdoesntshowup");

Posting Permissions

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



Click Here to Expand Forum to Full Width