Skip to main content
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks

  

Sign in to participate PreviousPrevious NextNext


Eric Forte 3.May.12 03:52 PM a Web browser
Domino Designer 6.5.6 Windows XP


I didn't know that if a document was a soft deletion it would still show up in collections, like the responses collection or the "AllDocuments" collection of NotesDatabase.

Here's a sample script that you can import into an agent. It shows a few simple NotesAPI-based calls that you can use to determine if a document is a soft deletion or not.

I hope this saves somebody a few hours!

Enjoy!

Eric Forte
@ericnforte

=================
Option Public
Option Explicit

Declare Private Function W32_NSFNoteOpen Lib "nnotes" Alias "NSFNoteOpen" (Byval hdb As Long, Byval NoteID As Long, Byval OpenFlags As Integer, lnghNote As Long) As Integer
Declare Private Function W32_NSFNoteOpenSoftDelete Lib "nnotes" Alias "NSFNoteOpenSoftDelete" (Byval hdb As Long, Byval NoteID As Long, Byval OpenFlags As Integer, lnghNote As Long) As Integer
Declare Private Function W32_NSFDbOpen Lib "nnotes" Alias "NSFDbOpen" (Byval PathName As String, rethDB As Long) As Integer
Declare Private Function W32_NSFDbClose Lib "nnotes" Alias "NSFDbClose" (Byval hDB As Long) As Integer
Declare Private Function W32_NSFNoteClose Lib "nnotes" Alias "NSFNoteClose" (Byval note_handle As Long) As Integer

Function isSoftDeletion(doc As NotesDocument, hdb As Long) As Boolean
%REM
If you can open the note with NSFNoteOpen, then it's not a soft deletion. If you cannot, but can then open it with
NSFNoteOpenSoftDelete, then it is a soft deletion.

Of course, you would probably want to test to make sure the document passed in is not "Nothing" before trying this.
%END REM
Dim hNote As Long
Dim rc As Integer

rc = W32_NSFNoteOpen(hdb, Val("&h" & doc.NoteID), 0, hNote)
If rc = 0 Then
'Not a soft deletion
W32_NSFNoteClose hNote
Else
rc = W32_NSFNoteOpenSoftDelete(hdb, Val("&h" & doc.NoteID), 0, hNote)
If rc = 0 Then
isSoftDeletion = True
W32_NSFNoteClose hNote
End If
End If
End Function
Function getAPIDbHandle(db As NotesDatabase) As Long
Dim hdb As Long
Dim rc As Integer

If db.Server = "" Then
rc = W32_NSFDbOpen(db.FileName, hDb)
Else
rc = W32_NSFDbOpen(db.Server & "!!" & db.FileName, hDb)
End If

If rc = 0 Then
getAPIDbHandle = hDb
Else
getAPIDbHandle = 0
End If
End Function
Sub Initialize
%REM
This was written with Lotus Notes 6.5 in mind. Documents that are soft deletions, among other things, still show up in collections, like
the "Responses" collection. You can't really use the NotesAPI function NSFSearch from within LotusScript because of the need to
provide a callback function.

However, you can pass a NoteID to NSFNoteOpen, then NSFOpenSoftDeletion to see if it is a soft deletion (see function isSoftDeletion)

Enjoy!

3-May-2012 - Eric Forte
@ericnforte
%END REM
Dim s As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim hDb As Long

Set db = s.CurrentDatabase

hDb = getAPIDbHandle(db)
If hDb = 0 Then
'Error getting db handle
Exit Sub
End If

Set dc = db.AllDocuments
Set doc = dc.GetFirstDocument
While Not doc Is Nothing
If isSoftDeletion(doc, hDb) Then
Print "Doc is soft deletion"
Else
Print "Doc is not soft deletion"
End If

Set doc = dc.GetNextDocument(doc)
Wend

Call W32_NSFDbClose(hDb)

End Sub


=================






Determining if a document is a soft... (Eric Forte 3.May.12)
. . RE: Determining if a document is a ... (Paul K Smerdon 8.May.12)
. . . . RE: Determining if a document is a ... (Eric Forte 8.May.12)





  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

 Sign In or Register
Sign in
Forgot your password?
Forgot your user name?
Create new registration

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

Resources

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds

Wikis

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums


 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
Notes/Domino 4 and 5
IBM Connections
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
IBM SmartCloud Meetings
IBM Web Content Manager
Lotus Domino Document Manager
Lotus e-learning
Lotus Enterprise Integration
Lotus Expeditor
Lotus Protector
Lotus Quickr
Lotus SmartSuite
Lotus Symphony
Lotus Symphony Developer Toolkit Support
Lotus Workflow