Emailed Button - Add User to Group

Hi,I dont have a great background in scripting, so…

Is there a way I can email a list of users buttons which when the appropriate one (to them) is pressed will automatically add them to a specific Notes Group?

Thanking you in advance…

Subject: Emailed Button - Add User to Group

Adding the user to a group via a scripted button would be fairly straightforward. However, if you want to add them to groups in the Domino Directory, the problem you’ll most likely run into is the Access Control List. While you may have Editor or higher access to it, your users probably will not. This will prevent them from modifying a group. Unlike agents, you can’t controll access rights/“run as” settings on buttons. You probably could create agents in your mail template to accomplish this task, however.

Subject: RE: Emailed Button - Add User to Group

Thanks Brent for that, at least I know now a button can do this. As for user access, thats sortable.

You wouldnt have URLs etc that could point me in the right direction for scripting the button??

Thanks again, much appreciated

Subject: RE: Emailed Button - Add User to Group

Eamonn,

Here is some very basic code that’s only semi tested, but it should work fine, assuming the user has access to edit the Group document. A few caveats. . . the filename of the Domino Directory is hardcoded. Make sure to put your group name in the “group” constant. The UserName property of NotesSession returns the canonical name. This should work, but double check access before you roll out the buttons. Lastly, there is no error checking in the script. You may want to add some in case the db, view, group, etc., can’t be found.

Put the following in your button’s Click event:

Dim session As New NotesSession

Dim thisdb As NotesDatabase

Dim server As String

Dim namesdb As NotesDatabase

Dim view As NotesView

Dim gdoc As NotesDocument

Dim members As NotesItem

’ Dim group As String

Dim user As String



Const group = "<YourGroupHere>"										'could also be captured by the script instead of hardcoded



Set thisdb = session.CurrentDatabase									'current database, likely the user's mail file

user = session.UserName													'current user's name

server = thisdb.Server															'server the current database resides on

Set namesdb = session.GetDatabase(server, "names.nsf")	'Domino Directory on current server

Set view = namesdb.GetView("Groups")								'Groups view in Domino Directory

Set gdoc = view.GetDocumentByKey(group, True)					'the group you wish this button to modify

Set members = gdoc.GetFirstItem("Members")						'the Members field in the group document

Call members.AppendToTextList(user)								'add the user's name to this group

Call gdoc.Save(True, True)													'save the group document w/the new value

Msgbox “Your name has been successfully added to the " & group & " group”, , “Name Added”

Hope this helps. Let me know if you need more info.

Subject: RE: Emailed Button - Add User to Group

For the cherry on top…Is there anyway so that users do not have to Trust Signer etc when pressing the button?

Anyway other than messing around with the ECL (which Im a little hazy on)?

Thanks

Subject: RE: Emailed Button - Add User to Group

Thanks for the kind words. It’s always nice to get a favorable response to posted solution. Yours was much appreciated!

Regarding the whole trust signer thingy. . . I’m afraid I’ll have to offer a raspberry instead of a cherry. I don’t know if you can avoid it without changing the ECL. I’m also a little hazy on it. Did your AdminP button also prompt the user with the ECL stuff? Here’s an idea. What if you tweaked the ECL settings on the server, then in your button’s script, put Evaluate(“@RefreshECL”) in your button prior to modifying the group? If you try it, let me know if it works. Cheers.

Subject: RE: Emailed Button - Add User to Group

I think I have a sneaky way around it, Ill get a colleague who is already in the ECL to sign the button. That should work nicely.

Evaluate(“@RefreshECL”) - will the user not have to trust me one more time when it runs?

Yeah the AdminP also prompted for Trust Signer.

I am a lover of the ol’ “use a hammer and the square peg will go into round hole” approach

Thanks again Brent for all.

Why does Lotus Notes always want the user to say yes to administrator actions?

IBM - Have you ever tried getting users to do things??!?

Account rename… shudders

I think I heard Release 7 removes the need for user ok to actions (at least the A/c rename…)? Couldnt happen soon enough…

Subject: RE: Emailed Button - Add User to Group

Brent!Wow, that just blew me away! It works a charm.

I had been tinkering with a button using adminp.AddGroupMembers it worked but was decidedly clunky in comparision to yours.

Many many thanks Brent for this. It is very much appreciated!