Solved

Automated way to rename a user object

Posted on 2006-07-20
15
315 Views
Last Modified: 2008-02-01
I have made several VB6 programs to automate changes in NDS.  Now I want to make a program that will rename a user object.  I know how to do it manually, but what I'm looking for is something like an API that will allow me to do it within a VB program.  I currently use the clsNovellAPI module for several programs.  Does anyone know how I can do this?

Thanks for the help!
BPL
0
Comment
Question by:bpl5000
  • 5
  • 5
  • 5
15 Comments
 
LVL 34

Expert Comment

by:PsiCop
Comment Utility
Hmmm...

I've done this sort of thing, but using Perl. See my May 10th, 2006 AppNote on Novell's Cool Solutions website --> http://www.novell.com/coolsolutions/appnote/bydate.html
0
 
LVL 34

Expert Comment

by:PsiCop
Comment Utility
Seems to me that what you want to change is the Object's Common Name, or CN, Attribute. Shouldn't be difficult, altho you should check to avoid name collisions within the OU. A CN must be unique for a given Layout within an OU, but since, unlike AD, eDirectory is an actual 3-D hierarchical database, uniqueness is not required beyond that (AD is just a 3-D view of the same 2-D namespace as NT4 Domains).

If you've already been using the VB APIs for other changes to eDirectory objects, is there a problem renaming Objects via that API?
0
 
LVL 5

Author Comment

by:bpl5000
Comment Utility
I'm sure there is a way to rename an object in the API that I'm using; I'm just too stupid to figure it out.  There is a move function in this module and I can rename the object into another OU with this function and then move it back to the original OU (but then I have to put in a sleep statement and it's not a very clean way).  Maybe if you look at the code, you would know how to rename an object with it.  Here's the code:

http://forgeftp.novell.com//vb6-api-class/vb6-api-class/Version%201.58/clsNovellAPI.cls

Thanks for the help!
0
 
LVL 34

Expert Comment

by:PsiCop
Comment Utility
I'd look, but I really don't grok VB.

In the Perl APIs, I'd use the "GetFieldVaue" and the "SetFieldValue" functions. I suspect that in all the APIs, you're not going to find a "RenameObject" function. You'll be using the functions that manipulate Attributes to change the "CN" Attribute.
0
 
LVL 5

Author Comment

by:bpl5000
Comment Utility
There is a SetFieldValue function, I just have no idea on how to use it.  Under that function, I don't see any declared variables that look as if they would be the CN.  For example, there is a variable called "EmailAddress", but nothing like "CN" or "LoginName", etc.
0
 
LVL 34

Expert Comment

by:PsiCop
Comment Utility
I use the SetFieldValue method in the sample code in my AppNote, extensively.

To learn how to use it, I actually referenced the Novell Script for NetWare (NSN) documentation, as there is no Perl-specific documentation. My point being that the API usage was consistent across the programming environments, I didn't need a Perl version of the documentation, I just needed to translate the NSN syntax into Perl.

SetFieldValue takes, as one of its arguments, the name of the Attribute for which the Value is to be modified. SetFieldValue is applicable to any Object type and any Attribute of the Object - you specify the Attribute in the method call.
0
 
LVL 35

Accepted Solution

by:
ShineOn earned 500 total points
Comment Utility
Other API's have functions specifically for renaming objects, probably like the one PsiCop is referring to with Perl.  I don't know where the VB API you linked to gets its objects from.  A lot of the API's for C on the developernet site, from the NDK, can be accessed from VB by defining the object calls appropriately, IIRC.  That may be the way to go.

The two "core services" API  functions relevant to renaming objects are NWDSModifyDN() and NWDSModifyRDN()

Then there's the "visual basic libraries for Novell services" that is essentially a txt file with translations and stuff so you can access the C lib functions in VB, including the NWDSModifyDN() and NWDSModifyRDN() functions.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 35

Expert Comment

by:ShineOn
Comment Utility
Oops, forgot to give you a link.

For the "Visual Basic Libraries for Novell Services" go to: http://developer.novell.com/wiki/index.php/Special:Downloads/vblib/builds/windows/novell-vblib-devel-2004.10.06-1windows.exe

The C libraries for eDirectory are at: http://developer.novell.com/wiki/index.php/EDirectory_Libraries_for_C
0
 
LVL 5

Author Comment

by:bpl5000
Comment Utility
ShineOn, I installed both exe files from the link you gave me.  I see the Novell.txt file which does contain declaritions for NWDSModifyDN and NWDSModifyRDN, but I'm wondering what I do with this file?
0
 
LVL 35

Expert Comment

by:ShineOn
Comment Utility
According to the readme, the txt file can be added as a module into a VB project, or used through the API viewer.  I think the sample project included with the "visual basic libraries..." download shows using it as an added module.
0
 
LVL 5

Author Comment

by:bpl5000
Comment Utility
Ok, I now have the module in my program and have the code for what I hope will rename the user object, but I do not understand why the first variable passed to the function is a Long.  It says "ByVal context As Long" and I don't understand how the context can be a number?  The only way I know to express the context is as a string.  Unless context here does not refer to "OU.OU.O".
0
 
LVL 34

Expert Comment

by:PsiCop
Comment Utility
That variable could be the unique Object ID instead of the context.
0
 
LVL 35

Expert Comment

by:ShineOn
Comment Utility
That's not a "context" as we discuss it as regards FQDN.  It's a handle used by the program, similar to a "file handle."  That's why it's a number.

You start out each program by setting your context handle first, then for the "context" part of each function using the variable for "context" you set with the create context handle function (NWDSCreateContextHandle) in that first positional parameter.  Just like you'd use a file handle variable when working with a file.
0
 
LVL 5

Author Comment

by:bpl5000
Comment Utility
Ok, my program is now working by using the NWDSModifyRDN function.  Thanks for explaining the context handle to me... that was confusing me.

I did find this on Novell's site:

The Modify RDN operation is implemented by the function NWDSModifyRDN(). This function is used to rename an object in the NDS database.

So ShineOn, you are correct... this is the function to use.

Thanks for the help guys!
0
 
LVL 35

Expert Comment

by:ShineOn
Comment Utility
Glad you got it working.  I love it when stuff I've never tried myself works in real life. ;)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
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 video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 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

12 Experts available now in Live!

Get 1:1 Help Now