Deleting a document from a view

This is the functionality I am looking for.

User is in a view.

User double clicks on a document.

The document opens.

User presses a ‘Delete’ button on the form

The document is permenantly deleted.

(When he goes back to the view he should not see the document with a delete flag)

I tried using lotus script, but since the uidoc is open when I try

Call doc.RemovePermanently( True )

It give me the error cannot delete doc. instantiated by uidoc.

Even though I am not doing doc=uidoc.document.

I tried doing a uidoc.close before

Call doc.RemovePermanently( True ) but still get the same error.

I tried using formula language:

@Command([EditDocument];“0”);

@Command([EditClear]);

@Command([FileCloseWindow])

But that just marks the document for deletion.

Allow soft deletions is not checked in the Database Properties.

Thanks for your time

Subject: Deleting a document from a view

You need to turn soft deletion on. You should then find that deletions work in a similar cmanner to Mail databases in that as soon as a document is deleted directly from the view or when teh document is opened it is immediately removed from the view.

Subject: RE: Deleting a document from a view

Not as difficult as you might think. You simply close the document, delete it from the backend, and then refresh the view. If you have a handle on the UIDocument or doc, then you must delete the handle before you can delete the doc. In order to do that, you use the documents UniversalID to grab it from the backend after you remove any existing handles to it. This is only an example, but you should get the process from this:

If you have a handle on the doc via the back-end, you remove the reference to UIDoc, and then delete the Doc object (which sets all references to DOC to NOTHING). You then delete the doc itself by backend:

Dim workspace as new NotesUIWorkspace

dim session as new NotesSession

dim db as NotesDatabase

dim uidoc as NotesUIDocument

dim dc as NotesDocumentCollection

dim doc as NotesDocument

dim unid as string

set db = session.CurrentDatabase

set dc = db.UnprocessedDocuments

if dc.Count=0 then error 1001, “Nothing Selected”

set doc = dc.GetFirstDocument

unid = doc.UniversalID

Set uidoc = workspace.EditDocument(False, doc)

’ user has doc open…reads it or whatever, and

’ now they want to delete it.

call uidoc.Close ’ Close our UIDoc

set uidoc = nothing ’ Set the handle to NOHTING

delete doc ’ Delete the doc object

set doc = db.GetDocumentByUNID( unid )

call doc.Remove(True)

call workspace.ViewRefresh

Cheers! - Ron