Adding names to a group using LotusScript

Hi All,Trying to add names to a group (not a view, a group in the address book) through LotusScript. Tried a few different approaches with no success. Any ideas?

Subject: Adding names to a group using LotusScript

Have You tested to use the new NotesAdminProcess class? There is a method called AddGroupMembers:

Sub Initialize
Dim session As New NotesSession
Dim adminp As NotesAdministrationProcess
Set adminp = _
session.CreateAdministrationProcess(“Software_Server”)
Dim guys(4) As String
guys(0) = “Admin Guy”
guys(1) = “Car Guy”
guys(2) = “Motorcycle Guy”
guys(3) = “Other Guy”
noteid$ = adminp.AddGroupMembers(“Guys”, guys)
If noteid$ <> “” Then
Dim db As New NotesDatabase(“Software_Server”, “admin4”)
Dim ws As New NotesUIWorkspace
Call ws.EditDocument(False, db.GetDocumentByID(noteid$))
End If
End Sub

Subject: Adding names to a group using LotusScript

Ok,The code seems to be working (using the AddGroupMember) but now in the Admin Request Database, I keep getting this Error: Both the signer and the author of this request must have the GroupModifier role in the Domino Directory.

I gave my myself that role in the names.nsf database, but I am still getting the error. Any suggestions?

Subject: RE: Adding names to a group using LotusScript

I assume the id you gave that role to is both the signer of the agent and the one you are using to run it?If so, you may either want to try flushing the cache on the server (db fl) and then tell adminp to process the request again. Alternatively, you may try creating a new request by running the agent again.

Also, were you not able to get the other agent to work? It seems more cut and dry to me as it is not utilizing adminp to do the work. - less points of failure.

Subject: RE: Adding names to a group using LotusScript

Probably an obvious answer to this question, but I must ask: I assume the id you gave that role to is both the signer of the agent and the one you are using to run it?If so, you may either want to try flushing the cache on the server (db fl) and then tell adminp to process the request again. Alternatively, you may try creating a new request by running the agent again.

Also, were you not able to get the other agent to work? It seems more cut and dry to me as it is not utilizing adminp to do the work. - less points of failure.

Sub Initialize

Dim nab As New NotesDatabase( "TRNSS01", "names.nsf" )	

Dim nabview As NotesView

Set nabview = nab.GetView("Groups")	

nabview.AutoUpdate = False

Dim nabdoc As NotesDocument	

Dim item As NotesItem



Set nabdoc = nabview.GetDocumentByKey( "Company Mail List" , True )

Set Item = nabdoc.GetFirstItem( "Members" )

Call Item.AppendToTextList( "Abagail Boregaurd" )

Call nabdoc.Save( True, False )

End Sub

Subject: Adding names to a group using LotusScript

What have you tried so far?

Something along these lines should work fine:

– snip –

FullGroupName = “WhateverYouWant”

Set GroupDoc = lookupview.GetDocumentByKey( FullGroupName , True )

Set MembersItem = GroupDoc.GetFirstItem( “Members” )

Call MembersItem.AppendToTextList( “Your Name Here/ACME” )

Call GroupDoc.Save( True, True )

– snip –

Subject: RE: Adding names to a group using LotusScript

Thanks for the info. After I posted, I found the addGroupMembers function in the help file. I will try both, to see which one works best!