Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / August 2006

Tip: Looking for answers? Try searching our database.

DirectoryEntry.CopyTo Not Implemented!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Davie - 07 Aug 2006 13:37 GMT
.NET 2.0

I was hoping the CopyTo method would be just what I needed to create a new
user in the same container and with the same properties as an existing one.
Rather than have to create the user and configure all the properties
manually.  Something like the code below.  However, when I try this I get a
not implemented exception.

Am I doing something wrong?  If this isn't possible, could someone suggest a
way to create a new user based on an existing one please.

Dim newUsr As DirectoryEntry = copyFromUsr.CopyTo(copyFromUsr.Parent,
"newUserName")
Marc Scheuner - 08 Aug 2006 05:35 GMT
>I was hoping the CopyTo method would be just what I needed to create a new
>user in the same container and with the same properties as an existing one.

You're not alone in this!

>Am I doing something wrong?  If this isn't possible, could someone suggest a
>way to create a new user based on an existing one please.

Unfortunately, as you found out, the .CopyTo method is indeed *NOT*
implemented in the LDAP provider of the .NET framework. It is only
implemented in the NDS:// provider (Novell Directory Services).

Unfortunately, when talking to MS about this, they were not hinting at
all at implementing this anytime soon, citing there were numerous
potential problems with copying a given user to a new one.

Basically, all you can do is:

1) Create a new (blank) user
2) Loop over all or some of the source user's properties and set the
new user's properties to the same values (where those make sense)

There's no help from the S.DS namespace to do this, unfortunately.

Sorry I can't be of more help...

Marc

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.