Improve company productivity with a Business Account.Sign Up

x
?
Solved

Automated way to rename a user object

Posted on 2006-07-20
15
Medium Priority
?
344 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
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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 
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

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This is a Step by Step guide to performing a Non-Destructive Windows 10 repair which answers frequently asked questions as to exactly what is lost, and what is kept. Enjoy...
Get to Know about Lotus Notes email migration to Office 365 in detail. Explore the article for better Lotus Notes to Office 365 migration techniques to transfer all data items to the O365 domain.
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…
Watch the video of Kernel Migrator for SharePoint, which demonstrate the process easily of migration from SharePoint to SharePoint, OneDrive for Business & Google Drive servers, Public Folder to SharePoint, File Server to SharePoint. The tool has va…

595 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