Solved

directoryentry value

Posted on 2013-12-19
5
202 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
  • 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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

713 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