Solved

directoryentry value

Posted on 2013-12-19
5
204 Views
Last Modified: 2014-01-08
I'm creating a group using this:
Dim group As DirectoryEntry = adEntry.Children.Add(strCN,"group")

At this point, while debugging, I can use
debug.print group.justcreated
and it returns True.

However, if I try to access that value in my code, I get
justcreated is not a member of system.directoryservices.directoryentry
0
Comment
Question by:sirbounty
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 15

Expert Comment

by:unknown_routine
ID: 39729654
justcreated is not currency a member of directoryentry.

You can see the list of members here:

http://msdn.microsoft.com/en-us/library/system.directoryservices.directoryentry_members(v=vs.71).aspx


I guess what you see could be the reason of incompatibility between different versions of .NEt Framework.


I suggest to you Exist method instead of justcreated . Exists is in all version of ,Net Framework.

debug.print group.Exists("c\MyFolder")
0
 
LVL 67

Author Comment

by:sirbounty
ID: 39730027
.exists doesn't work for what I'm trying to do...  this is not a directory as in a folder, this is a directory as in Active Directory object...
0
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 500 total points
ID: 39743904
JustCreated is a private member which normally cannot be used in your own code (only inside the class itself) but is visible to the debugger.

If you add your variable group to the watch list, you will see a number of members/properties/methods that have an icon with a key to the left of it. That indicates they're private.
capture watchlistYou can get to the value of private members using Reflection:
Imports System.Reflection
' ...
        'Dim group As New DirectoryEntry() ' my test object
        Dim typDirectoryEntry As Type = GetType(DirectoryEntry) ' or group.GetType()
        For Each objMemberInfo As MemberInfo In typDirectoryEntry.GetMembers(BindingFlags.Instance Or BindingFlags.NonPublic)
            Console.WriteLine("name: {0}", objMemberInfo.Name)
            If objMemberInfo.Name = "JustCreated" Then Console.WriteLine("found it! value = {0}", typDirectoryEntry.GetField(objMemberInfo.Name, -1).GetValue(group).ToString)
        Next

Open in new window

0
 
LVL 67

Author Comment

by:sirbounty
ID: 39754046
Holidays...will check soon and get back to you.  Thanks.
0
 
LVL 67

Author Closing Comment

by:sirbounty
ID: 39765011
Brilliant.  I've maxed the points because this is going to be very useful.  Thanks! :^)
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question