Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Lotus Notes "hard Delete" From VB

Posted on 2007-07-30
12
Medium Priority
?
712 Views
Last Modified: 2013-12-18
I have multiple .NSF files that I need to delete documents from by using the COM objects from VB6.
I loop the allDocuments folder and delete certain documents by using the "Remove" method.
This works fine except that the deleted documents remains in the Trash folder.
I did see that there is a database property called "Allow Soft Deletions" but cannot seem to access that from outside of Notes.
Any suggestions ? (Please do not suggest Notes agents as I have to do it from VB)

Thanks
0
Comment
Question by:AlphaGuys
  • 5
  • 4
  • 3
12 Comments
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 1000 total points
ID: 19592977
flag = notesDocument.RemovePermanently( force )
0
 

Author Comment

by:AlphaGuys
ID: 19600774
bosman,

This works great except for when the nsf file has documents in the Trash folder and the DB is set to "Allow Soft Delete"
oNotesDB.GETDOCUMENTBYUNID(sNotesUID) raises error:
"Invalid universal id" even though that document in the Trash folder actually does have this ID.

How do I get a reference to that document and remove it from Trash ?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 19601236
It should override soft delete:
http://www-12.lotus.com/ldd/doc/domino_notes/Rnext/help6_designer.nsf/f4b82fbb75e942a6852566ac0037f284/88c377cc240a5e8b85256c54004cdf62?OpenDocument

Quote: "Permanently deletes a document from a database, doing a hard deletion even if soft deletions are enabled."

And you have the permission in the ACL to delete a document??
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:AlphaGuys
ID: 19601314
When the document sits in Trash folder I cannot even get a reference to it in order to delete it using
oNotesDB.GETDOCUMENTBYUNID(sNotesUID)  raises error "Invalid universal id"

Yes I do have all permissions
0
 

Author Comment

by:AlphaGuys
ID: 19601428
Let me just clarify that. When I say the document is in the Trash folder it is not one that I deleted but sits in the original nsf source file before I start working on it.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 19602254
The Trash-folder is a bit of a strange thing in Notes: the documents still exist in the database, yet they do not exist for any ordinary call. They won't appear in an ordinary view, and the Trash-folder is a special case. It might be possible to open the Trash-folder and go though it, using GetNextDocument calls. DON'T open the document, most likely that won't work, but it should be possible to get the unique id. The property NotesDocument.Deleted should be true in this case, so you can see it's actually a (soft) deleted document.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 19602383
I just checked. In one database template I developed, there is a Trash view. It's just called Trash and has only some basic info: the unique id, the note-id, and the creation and modification dates. It might be a way to get to your document, the view might be sortable on the unique id. Unfortunately, the Trash folder in mail doesn't have the unique id in a column. Nevertheless, if the Trash folder is kept empty, you might just find your document by going through the view.
0
 
LVL 31

Assisted Solution

by:qwaletee
qwaletee earned 1000 total points
ID: 19605484
I just ran a script against my SoftDeletions to get the first doc in the view, print the subject , and delete it using RemovePermanently.  No errors, and it did remove it (had to press F9 for the deleteion to occur in the UI).

      Dim mail As New NotesDatabase ("","")
      mail.OpenMail
      Dim trash As notesView
      Set trash = mail.getView("($SoftDeletions)")
      Dim doc As notesDocument
      Set doc = trash.GetFirstDocument
      Print doc.Subject(0)
      doc.RemovePermanently True

So, at least in 7.01 it appears to work properly.
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 19605499
Note on above:
Run from LotusScript, but I would believe =it would work perfeclt from COM, except that instead of the first two lines you would use
Dim s as new Notes.NotesSession
Dim dbd as Notes.NotesDbDirectory
Dim mail as Notes.Notesdatabase
Set dbd=s.getDbDirectory("")
Set mail = dbd.OpenMailDatabase


Note 2:
The problem isn't so much getting the doucment as getting the document by UNID.  It appears you would have to locate it in the soft deletions view.  If that view is not particularly large, you could loop through it comparing each document.UniversalID to the sNotesUID value
0
 

Author Comment

by:AlphaGuys
ID: 19611786
Good job guys. I've split the points between you since I have to use a combination of your answers.

Thanks again
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 19615535
:-)
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 19617062
What did you combine? FInal script...
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month15 days, 11 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question