Wednesday, June 28, 2006

LotusScript to restore removed QuickPlace

This is a LotusScript button that the QuickPlace SU administrator can run on a server to restore a QuickPlace that has been removed with QPTool. It goes through and changes all the titles of the place back to their original one before being marked as [Pending Deletion].

Dim s As notessession
Dim server As String
Dim placename As String
Sub Click(Source As Button)
Set s = New notessession

placename = "yourplacename"
server = "yourserver/projectlounge"

Print "Starting in main room"
Call restoredb(placename, "quickplace/"+placename+"/main.nsf")

End Sub

Sub restoredb(roomtitle, roompath)
Dim roomdb As NotesDatabase
Dim roomview As notesview

Set roomdb = s.GetDatabase(server, roompath)
If roomdb.IsOpen = False Then
Call roomdb.Open(server, roompath)
End If
roomdb.Title = roomtitle
Print "Set title: " + roomtitle

Set roomview = roomdb.GetView("System\Subrooms")
Dim doc As NotesDocument
Set doc = roomview.GetFirstDocument
While Not (doc Is Nothing)
Dim iroomtitle As String
Dim iroomfile As String

iroomtitle = doc.GetItemValue("h_Name")(0)
iroomfile = doc.GetItemValue("h_LocDbName")(0)

Print "Working on: " + iroomfile
Call restoredb(iroomtitle, "quickplace/"+placename+"/" + iroomfile)

Set doc = roomview.GetNextDocument(doc)
End Sub

No comments: