
- VBForums
- .NET and More
- C#
- [RESOLVED] Looping Through the DirectoryEntry.Children Objects Doesn't Pull All Attribute Names
-
Nov 30th, 2012, 11:26 AM
#1
[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:
foreach (PropertyValueCollection p in ChildObject.Properties)
{
ActiveDirectoryAttributeList ADAList = new ActiveDirectoryAttributeList();
ADAList.Attribute = p.PropertyName;
ADAList.AttributeValue = p.Value.ToString();
ChildNode.Attributes.Add(ADAList);
}
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
 Originally Posted by SJWhiteley
"game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....
-
Nov 30th, 2012, 11:34 AM
#2
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
-
Nov 30th, 2012, 11:44 AM
#3
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");

- VBForums
- .NET and More
- C#
- [RESOLVED] Looping Through the DirectoryEntry.Children Objects Doesn't Pull All Attribute Names
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|