Skip to main content
BlueMix free trial
 
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

RE: Get deletion stubs
JY Riverin 5.Apr.07 08:30 AM a Web browser
Domino Server All Releases All Platforms


Hi,

don't know if it can be done in VB , but by script you can get the stubs. You will have to tweak it a little bit, but it's working




' --- custom user-defined type for storing deletion stub information
Type DELETION_STUB
NoteID As String
NoteClass As String
Datte As String
DBID As String
End Type

' --- Notes C API declares and constants (translated from the header files)
Type TIMEDATE
Innards(1) As Long
End Type

Type OID
FileDBID As TIMEDATE
Note As TIMEDATE
Sequence As Long
SequenceTime As TIMEDATE
End Type

Declare Sub W32OSPathNetConstruct Lib "nnotes" Alias "OSPathNetConstruct" ( _
Byval portName As Lmbcs String, _
Byval ServerName As Lmbcs String, _
Byval FileName As String, _
Byval retPathName As String _
)

Declare Function W32NSFDbOpen Lib "nnotes" Alias "NSFDbOpen" ( _
Byval PathName As Lmbcs String, _
rethDb As Long _
) As Integer

Declare Function W32NSFDbClose Lib "nnotes" Alias "NSFDbClose" ( _
Byval hDb As Long _
) As Integer

Declare Sub W32TimeConstant Lib "nnotes" Alias "TimeConstant" ( _
Byval TimeConstantType As Integer, _
td As TIMEDATE _
)


Declare Function W32NSFDbGetModifiedNoteTable Lib "nnotes" Alias "NSFDbGetModifiedNoteTable" ( _
Byval hDb As Long, _
Byval NoteClassMask As Integer, _
Byval Innards1 As Long, _
Byval Innards2 As Long, _
retUntil As TIMEDATE, _
rethTable As Long _
) As Integer

Declare Function W32IDEntries Lib "nnotes" Alias "IDEntries" ( _
Byval hTable As Long _
) As Long

Declare Function W32IDScan Lib "nnotes" Alias "IDScan" ( _
Byval hTable As Long, _
Byval fFirst As Integer, _
retID As Long _
) As Integer

Declare Function W32IDDestroyTable Lib "nnotes" Alias "IDDestroyTable" ( _
Byval hTable As Long _
) As Integer

Declare Function W32OSLoadString Lib "nnotes" Alias "OSLoadString" (Byval hModule As Long, _
Byval StringCode As Integer, _
Byval retBuffer As Lmbcs String, _
Byval BufferLength As Integer _
) As Integer

Declare Function W32NSFDbGetNoteInfo Lib "nnotes" Alias "NSFDbGetNoteInfo" ( _
Byval hDb As Long, _
Byval NoteID As Long, _
retNoteOID As OID, _
retModified As TIMEDATE, _
retNoteClass As Integer _
) As Integer

Const NOERROR = 0
Const NULLHANDLE = 0&
Const MAXPATH = 256
Const TIMEDATE_WILDCARD = 2
Const NOTE_CLASS_ALL = &H7fff
Const RRV_DELETED = &H80000000&
Const PKG_NSF = &H200
Const ERR_NOTE_DELETED = PKG_NSF + 37

' --- note classifications
Const NOTE_CLASS_DOCUMENT = &H0001
Const NOTE_CLASS_INFO = &H0002
Const NOTE_CLASS_FORM = &H0004
Const NOTE_CLASS_VIEW = &H0008
Const NOTE_CLASS_ICON = &H0010
Const NOTE_CLASS_DESIGN = &H0020
Const NOTE_CLASS_ACL = &H0040
Const NOTE_CLASS_HELP_INDEX = &H0080
Const NOTE_CLASS_HELP = &H0100
Const NOTE_CLASS_FILTER = &H0200
Const NOTE_CLASS_FIELD = &H0400
Const NOTE_CLASS_REPLFORMULA = &H0800
Const NOTE_CLASS_PRIVATE = &H1000




Sub Click(Source As Button)
%REM
This Sub opens the current database and prints information about all its deletion stubs to the status bar.

Copyright 2001 Paul Ray. Use at your own risk.
%END REM

Dim s As New NotesSession
Dim sPath As String
Dim hDb As Long
Dim iStatus As Integer
Dim stubs() As DELETION_STUB

' --- build an API-friendly path to the current database (i.e., <Server>!!<FilePath>)
sPath = String$( MAXPATH, 0 )
W32OSPathNetConstruct "", "Serveur", "RJY\reserve.nsf", sPath
' W32OSPathNetConstruct "", s.CurrentDatabase.Server, s.CurrentDatabase.FilePath, sPath

sPath = Left$( sPath, Instr(1, sPath, Chr$(0)) - 1 )

' --- open the database
iStatus = W32NSFDbOpen( sPath, hDb )

If iStatus <> NOERROR Then

' --- display any errors returned from C API call
Msgbox GetCAPIErrorMsg( iStatus ), 48, "Notes C API Error"

Else

' --- generate an array of deletion stubs
DumpDeletionStubs hDb, stubs

' --- close the database
W32NSFDbClose hDb

' --- print out all the stubs to the status bar
Forall note In stubs
Print "Deletion stub found: Note ID = " + note.NoteID + ", Note class = " + note.NoteClass + ", Date = " + note.datte
End Forall

End If
End Sub



Function GetNoteClass( iNoteClass As Integer ) As String
%REM
GetNoteClass - This function takes a note type and returns a text string representing the note class type to the caller.
%END REM

Dim sNoteType As String

Select Case iNoteClass

Case NOTE_CLASS_DOCUMENT
sNoteType = "Document"

Case NOTE_CLASS_INFO
sNoteType = "Help-about"

Case NOTE_CLASS_FORM
sNoteType = "Form"

Case NOTE_CLASS_VIEW
sNoteType = "View"

Case NOTE_CLASS_ICON
sNoteType = "Icon"

Case NOTE_CLASS_DESIGN
sNoteType = "Design collection"

Case NOTE_CLASS_ACL
sNoteType = "ACL"

Case NOTE_CLASS_HELP_INDEX
sNoteType = "Help index"

Case NOTE_CLASS_HELP
sNoteType = "Help-using"

Case NOTE_CLASS_FILTER
sNoteType = "Filter"

Case NOTE_CLASS_FIELD
sNoteType = "Field"

Case NOTE_CLASS_REPLFORMULA
sNoteType = "Replication formula"

Case NOTE_CLASS_PRIVATE
sNoteType = "Private design"

Case Else
sNoteType = "Unknown"

End Select

GetNoteClass = sNoteType
End Function


Function GetCAPIErrorMsg( iStatus As Integer ) As String
%REM
GetCAPIErrorMsg - This function takes a status code returned from a C API call, retrieves the corresponding
error message from Notes' internal string tables, and returns the string to the caller.
%END REM

Dim iLen As Integer
Dim sBuffer As String

' --- initialize a buffer of adequate length to accept the error string
sBuffer = String$( 256, 0 )

' --- get the API error message from the internal Notes/Domino string tables
iLen = W32OSLoadString( NULLHANDLE, iStatus, sBuffer, Len( sBuffer ) - 1 )

If iLen > 0 Then

' --- remove any trailing characters from the string and return it to the caller
GetCAPIErrorMsg = Left$( sBuffer, Instr( 1, sBuffer, Chr$(0) ) - 1 )

Else

' --- couldn't locate the error message in the string tables
GetCAPIErrorMsg = "Unknown error"

End If
End Function



Sub DumpDeletionStubs( hDb As Long, stubs() As DELETION_STUB )
%REM
DumpDeletionStubs - This Sub takes a C API handle to a database and dynamically builds an array of DELETION_STUB
types containing information about all the deletion stubs in the database.
%END REM

Dim s As String
Dim ns As Integer
Dim hTable As Long, NoteID As Long, DeletedNoteID As Long, ct As Long
Dim iStatus As Integer, bFlag As Integer, iNoteClass As Integer
Dim tdStart As TIMEDATE, tdEnd As TIMEDATE, tdModified As TIMEDATE
Dim NoteOID As OID


Dim retStr As String*81
Dim retLen As Integer
Dim retCode As Integer

' --- get all notes modified since the database was created (including deletion stubs)
W32TimeConstant TIMEDATE_WILDCARD, tdStart

' --- get an ID table of all the notes in the database
iStatus = W32NSFDbGetModifiedNoteTable( hDb, NOTE_CLASS_ALL, tdStart.Innards(0), tdStart.Innards(1), tdEnd, hTable )

If iStatus <> NOERROR Then

Msgbox GetCAPIErrorMsg( iStatus ), 48, "Notes C API Error"

Else

ct = 0
bFlag = True

' --- scan all notes in the ID table
Do While W32IDScan( hTable, bFlag, NoteID )

' --- test for deleted flag bit
If ( NoteID And RRV_DELETED ) Then

' --- clear flag bit so we won't get an error indicating an invalid note
DeletedNoteID = NoteID And ( Not RRV_DELETED )

' --- get the information we need about the note
iStatus = W32NSFDbGetNoteInfo( hDb, DeletedNoteID, NoteOID, tdModified, iNoteClass )

' --- check to see that this note is in fact a deletion stub
If iStatus = ERR_NOTE_DELETED Then

' populate the array of DELETION_STUBs
Redim Preserve stubs( ct )
's = Space(80)
' ConvertTIMEDATEToText 0, 0, NoteOID.FileDBID.Innards(1), s, 80, ns


' retCode = ConvertTIMEDATEToText(0, 0, NoteOID, retStr, Len(retStr)-1, retLen)

stubs( ct ).NoteID = Hex$( DeletedNoteID )
stubs( ct ).DBID = Hex$( NoteOID.FileDBID.Innards(1) ) + ":" + Hex$( NoteOID.FileDBID.Innards(0) )
'tmp = (Cdat(NoteOID.sequencetime.Innards(1) + 2061182549))
stubs( ct ).Datte = (Cdat(NoteOID.sequencetime.Innards(1) + 2061182549))'Hex$( NoteOID.FileDBID.Innards(1) ) + ":" + Hex$( NoteOID.FileDBID.Innards(0) )

stubs( ct ).NoteClass = GetNoteClass( iNoteClass )
ct = ct + 1

Elseif iStatus <> NOERROR Then

' --- print out any errors that may occur while we're scanning the ID table
Print GetCAPIErrorMsg( iStatus ) + " (" + Hex$( DeletedNoteID ) + ")"

End If

End If

' --- tell W32IDScan we're not looking for the first note any longer
bFlag = False

Loop

' --- free the ID table from memory
W32IDDestroyTable hTable

End If
End Sub




Get deletion stubs (Markward Schube... 5.Apr.07)
. . RE: Get deletion stubs (JY Riverin 5.Apr.07)
. . . . Be careful (Randy Rhoades 5.Apr.07)
. . . . . . Thanks (Markward Schube... 23.Apr.07)
. . . . . . Thanks (Markward Schube... 23.Apr.07)
. . . . RE: Get deletion stubs (Leigh Melvin 20.Jan.16)


Document Options






  Document options
Print this pagePrint this page

Search this forum

Forum views and search


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

Sign In or Register

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

Member Tools


RSS Feeds

 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 Connections Cloud Developers
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
IBM Connections
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
Lotus Enterprise Integration
Lotus Protector
Lotus Quickr
Lotus SmartSuite