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
Solved

directoryentry value

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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)…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

791 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