Link to home
Start Free TrialLog in
Avatar of zipwilly05
zipwilly05

asked on

How do I create a toolbar button that will remove a folder?

How do I create a button on my toolbar that I can click to remove (delete) the currently selected folder? I understand how to create a custom toolbar but do not how to create a button that will perform the remove folder action.

I am running Lotus Notes client 8.0.1.
Avatar of Bill-Hanson
Bill-Hanson
Flag of United States of America image

You'll have to use LotusScript for this.

Here's a function that will remove a folder from the current database.  Just change the action type to LotusScript and paste this code into the 'Declarations' module.   Then call the function from the action's click event like this:

Call RemoveFolder("Folder Name")
Sub RemoveFolder(Byval folderName As String)
	
	Dim sess As New NotesSession
	Dim db As NotesDatabase
	Dim folder As NotesView
	Set db = sess.CurrentDatabase
	Set folder = db.GetView(folderName)
	If (folder Is Nothing) Then
		Msgbox "The folder does not exist!"
	Else
		Call folder.Remove
		Set folder = db.GetView(folderName)
		If (folder Is Nothing) Then
			Msgbox "The folder has been removed"
		Else
			Msgbox "Unable to remove the folder!"
		End If
	End If
	
End Sub

Open in new window

Avatar of zipwilly05
zipwilly05

ASKER

I have not written a LotusScript before.

How do I tie the execution of this script to toolbar button? Do I paste something into the Formuia box of the dialog that appears when I create a new toolbar button (see attachment)?

Where is the action that you reference in your response?
snap033.bmp
ASKER CERTIFIED SOLUTION
Avatar of Bill-Hanson
Bill-Hanson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I did not realize that command was available. Your answer is most helpful.