 |
|
| wrote a blog entry a couple of years ago with a solution on how to delete deletion stubs for a Lotus Notes database. Take a look at his code to accomplish that, very nice! I have modified it just a little bit to be able to first choose which database to work on and then to choose if you only want to count or if you want to count and delete them (Options):Option Public Const wAPIModule = "NNOTES" ' Windows/32 |
(Declarations):Declare Private Sub IDDestroyTable Lib wAPIModule Alias "IDDestroyTable" _ ( Byval hT As Long) Declare Private Function IDScan Lib wAPIModule Alias "IDScan" _ ( Byval hT As Long, Byval F As Integer, ID As Long) As Integer Declare Private Function NSFDbOpen Lib wAPIModule Alias "NSFDbOpen" _ ( Byval P As String, hDB As Long) As Integer Declare Private Function NSFDbClose Lib wAPIModule Alias "NSFDbClose" _ ( Byval hDB As Long) As Integer Declare Private Function NSFDbGetModifiedNoteTable Lib wAPIModule Alias "NSFDbGetModifiedNoteTable" _ ( Byval hDB As Long, Byval C As Integer, Byval S As Currency, U As Currency, hT As Long) As Integer Declare Private Function NSFNoteDelete Lib wAPIModule Alias "NSFNoteDelete" _ ( Byval hDB As Long, Byval N As Long, Byval F As Integer) As Integer Declare Private Function OSPathNetConstruct Lib wAPIModule Alias "OSPathNetConstruct" _ ( Byval NullPort As Long, Byval Server As String, Byval FIle As String, Byval PathNet As String) As Integer Declare Private Sub TimeConstant Lib wAPIModule Alias "TimeConstant" _ ( Byval C As Integer, T As Currency) Dim Db As NotesDatabase
|
Initialize:Sub Initialize Dim Session As New NotesSession Dim ws As New NotesUIWorkspace Dim dbInfo As Variant Dim sDbServer As String Dim sDbPath As String Dim retVal As Integer dbInfo = ws.Prompt(13, "Choose database", "Choose a database") sDbServer = dbInfo(0) sDbPath = dbInfo(1) Set db = session.GetDatabase(sDbServer, sDbPath) retVal = ws.Prompt (PROMPT_YESNOCANCEL, _ "Delete or just count?", _ "Do you want to delete all of the deletion stubs in this database [Yes] or just count them [No]")
Select Case retVal Case 1 : Call countAndDeleteStubs(db, 1) Case 0 : Call countAndDeleteStubs(db, 0) Case -1 : Msgbox "Operation cancelled" End Select End Sub |
countAndDeleteStubs:Sub countAndDeleteStubs(db As NotesDatabase, choice As Integer) Dim ever As Currency, last As Currency Dim hT As Long, RRV As Long, hDB As Long With db np$ = Space(1024) OSPathNetConstruct 0, db.Server, db.FilePath, np$ End With NSFDbOpen np$, hDB TimeConstant 2, ever NSFDbGetModifiedNoteTable hDB, &H7FFF, ever, last, hT n& = 0 done = (IDScan(hT, True, RRV) = 0) While Not done If RRV < 0 Then If (choice = 1) Then NSFNoteDelete hDB, RRV And &H7FFFFFFF, &H0201 End If n& = n& + 1 End If done = (IDScan(hT, False, RRV) = 0) Wend IDDestroyTable hT NSFDbClose hDB If (choice = 1) Then Msgbox "Deleted " & Cstr(n&) & " stubs in database " & db.FilePath & " on server " & db.Server Else Msgbox "Database " & db.FilePath & " on server " & db.Server & " contains " & Cstr(n&) & " stubs" End If End Sub |
And here are the results when running the count...  and the delete option for a database.  |  |
| | Comments:
|
| | Comment posted 2008-09-16 13:08:27 by frederic hesse
I have some del stubs that domino can't delete thus :
i tried it using A shared action : --------------------------- IBM Lotus Notes --------------------------- PUBLIC is not allowed in this module --------------------------- OK ---------------------------
|
|
| | Comment posted 2008-11-19 20:55:54 by Mike
Hi there,
Can this code be modified and used commercially?
Thanks
|
|
| | Comment posted 2008-11-20 11:53:04 by
Hi Mike, Usually code that are displayed on public blogs as show'n'tell are subject for copy and paste as far as I know.
The real functionality of this code comes as it says in the post from Christophe Windelen. I have only added some extra code to make it more useful to me and to share it with the rest of the community.
You are welcome to use my add-on code, but you have to ask Christophe Windelen about the original code to be sure and to get the permission.
/ Niklas
|
|
| | Comment posted 2009-12-12 10:09:00 by Chetan
Can any one tell me how do we view or copy deletion stubs from one replica to another
|
|
| | Comment posted 2009-12-15 15:36:43 by Peter
Hi Niklas, Code seems to work perfecty well on Domino 6 server, but on Domino 8.5 it throws an "Process D:\IBM\Lotus\Domino\namgr.EXE (3168/0xC60) has terminated abnormally" and server need to be rebooted...Do you have any experience with that? Thanks!
|
|
| | Comment posted 2009-12-15 15:49:46 by Peter
Reverting back to the issue with the agent manager giving issues with Domino 8.5, I see the OS of the Domino server is 64 bits. In the comments of this code I see it is developed for 32 bits...Const wAPIModule = "NNOTES" ' Windows/32...can this 64 bits OS be causing the agent manager to be having problems? Thanks!
|
|
| | Comment posted 2009-12-16 19:37:23 by
Hi Peter, Sorry, I have no experience of this. I have only tried it for the version I wrote for in this blog entry. It would be interesting to look at this for 8.5 as well, but that will have to be when I have some time over.
Your idea regarding the 32/64 bit issue seems reasonable to me.
/ Niklas
|
|
| | Comment posted 2009-12-16 19:39:13 by
Hi Chetan, I'm sorry to say I have no direct answer on this one. I will have to check and when there is more time I will.
// Niklas
|
|
| | Comment posted 2010-02-28 07:40:52 by
Thanks for this. Very helpful.
|
|
| | Comment posted 2010-03-05 04:25:27 by Alfonso Diaz
How I can write this code in VB.net
|
|