Solved

directoryentry value

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now