How to restore a softdeleted document from LotusScript?

I want to do some additional tasks which I want to do in LotusScript.Here is my current script:

Sub Click(Source As Button)

Dim ss As New NotesSession

Dim ws As New NotesUIWorkspace

Dim UIView As NotesUIView

Dim db As NotesDatabase

Dim View As NotesView

Dim dc As NotesDocumentCollection

Dim dc2 As NotesDocumentCollection

Dim Doc As NotesDocument

Dim DelDoc As NotesDocument

Dim Agent As NotesAgent



Set db = ss.CurrentDatabase

Set dc = db.UnprocessedDocuments

Set Doc = dc.GetFirstDocument

Set View = db.GetView("DeletedChildDocs")



Do While Not Doc Is Nothing



	If Doc.TaskSubform(0) = "1" Then



		Set dc2 = View.GetAllDocumentsByKey(Doc.UniversalID)

		Call dc2.StampAll("Deleted", "")



	End If

	Set DelDoc = Doc

	Set Doc = dc.GetNextDocument(Doc)



Loop



Set UIView = ws.CurrentView

Set Doc = dc.GetFirstDocument



Do While Not Doc Is Nothing



	Call UIView.SelectDocument(Doc)

	Set Doc = dc.GetNextDocument(Doc)



Loop

’ Evaluate {@Command([EditRestoreDocument]);}

’ Evaluate {@Command([ToolsRunMacro]; “RestoreDocuments”)}

Set Agent = db.GetAgent("RestoreDocuments")

Call Agent.Run

End Sub

The RestoreDocuments agent contains a

@Command([EditRestoreDocument]);

and works well by itself.

To rephrase the question: how do you make LS to run this agent? It does not even start, but fails silently…

I put the second Do/Loop in as part of the struggle but did not help.

Can you?

Thanks!

Subject: How to restore a softdeleted document from LotusScript?

Actually it is simple. I am surpised i just tested. Set the form = memo.doc.form = “Memo”

Subject: Did you have to do a Save?