?
Solved

Automated way to rename a user object

Posted on 2006-07-20
15
Medium Priority
?
336 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
[X]
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
  • 5
  • 5
  • 5
15 Comments
 
LVL 34

Expert Comment

by:PsiCop
ID: 17147301
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
ID: 17147434
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
ID: 17147649
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
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

 
LVL 34

Expert Comment

by:PsiCop
ID: 17147716
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
ID: 17148541
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
ID: 17148703
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 2000 total points
ID: 17149558
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
 
LVL 35

Expert Comment

by:ShineOn
ID: 17149583
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
ID: 17153979
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
ID: 17154233
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
ID: 17154556
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
ID: 17156054
That variable could be the unique Object ID instead of the context.
0
 
LVL 35

Expert Comment

by:ShineOn
ID: 17156492
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
ID: 17158245
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
ID: 17158381
Glad you got it working.  I love it when stuff I've never tried myself works in real life. ;)
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Read on to get a few ideas on how to promote your next corporate event.
The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

719 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