Change a Group's Name Using AdminP

Mindwatering Incorporated

Author: Tripp Black

Created: 06/11/2010 at 04:13 PM

 

Category:
Notes Developer Tips
LotusScript

The function below is a wrapper for the RenameGroup method of the Administrative Process object.
It tests passed objects and returns the NoteID of the new request document if successful.

Function GroupNameChangeAdminP(s As NotesSession, svrnm, oldgrpnm As String, newgrpnm As String) As String
' function renames a group from oldgrpnm to newgrpnm
' returns the noteid of the new admin request in admin4.nsf
Dim admP As NotesAdministrationProcess

On Error Goto FErrorHandler

' test variables
If (svrnm="" Or oldgrpnm ="" Or newgrpnm="" Or s Is Nothing) Then
Exit Function
End If
Set admP = s.CreateAdministrationProcess(svrnm)
If (admP Is Nothing) Then
' should never happen as all servers typically run it and have admin4.nsf
GroupNameChangeAdminP = ""
Exit Function
End If
GroupNameChangeAdminP = admP.RenameGroup(oldgrpnm, newgrpnm)
' return noteid if successful
FExit:
Exit Function
FErrorHandler:
Print "(GroupNameChangeAdminP) Unexpected Error: " & Cstr(Err) & " " & Error$ & ", on line: " & Cstr(Erl) & "."
Resume FExit
End Function

previous page