' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ' * ' * Delete without leaving a replication stub ' * ' * sample code from ' * LotusScript to Lotus C API Programmer Guide by Normunds Kalnberzins, (c) 2000-2003 ' * ' * http://www.ls2capi.com ' * ' * Author: Normunds Kalnberzins ' * ' * This code has been written as a sample to illustrate aspects of handling of Lotus C API from LotusScript ' * and may be reused, modified on full responsibility of the developer and provided this notice is preserved ' * ' * The author does not guaranty it to fit any particular purpose and it is up to the developer ' * to modify, test it and determine the limits of its applicability ' * ' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ' * * * * * * * * START (Function library) [DELETE NOSTU ' * * * * * * * * ' * ' * deletes document leaving no replication stubs ' * ' * * * * * * * * START (Const) [MISC] ' * * * * * * * * ' * Const MAXPATH = 256 Const UPDATE_NOSTUB = &h0200 ' * * * * * * * * END (Const) [MISC] ' * * * * * * * * ' * * * * * * * * START (Declaration) [W32_NSFNOTEDELETE ' * * * * * * * * ' * Declare Function W32_NSFNoteDelete Lib "nnotes" Alias "NSFNoteDelete" _ ( Byval hDb As Long, Byval NoteID As Long, Byval UpdateFlags As Integer ) As Integer ' * * * * * * * * END (Declaration) [W32_NSFNOTEDELETE] ' * * * * * * * * ' * * * * * * * * START (Declaration) [W32_NSFDBOPEN] ' * * * * * * * * ' * Declare Function W32_NSFDbOpen Lib "nnotes" Alias "NSFDbOpen" (Byval PathName As LMBCS String, rethDB As Long) As Integer ' * * * * * * * * END (Declaration) [W32_NSFDBOPEN] ' * * * * * * * * ' * * * * * * * * START (Declaration) [W32_NSFDBCLOSE] ' * * * * * * * * ' * Declare Function W32_NSFDbClose Lib "nnotes" Alias "NSFDbClose" (Byval hDB As Long) As Integer ' * * * * * * * * END (Declaration) [W32_NSFDBCLOSE] ' * * * * * * * * ' * * * * * * * * START (Declaration) [W32_OSPATHNETCONS ' * * * * * * * * ' * Declare Function W32_OSPathNetConstruct Lib "nnotes" Alias "OSPathNetConstruct" (Byval portName As Lmbcs String, Byval ServerName As Lmbcs String, Byval FileName As Lmbcs String, Byval retPathName As Lmbcs String) As Integer ' * * * * * * * * END (Declaration) [W32_OSPATHNETCONSTR ' * * * * * * * * ' * * * * * * * * START (Method) [INITIALIZE] ' * * * * * * * * ' * Sub Initialize Dim ses As New notessession ' one and only session Dim ndb As notesdatabase ' current DB Dim doc As notesdocument ' current document being processed: Dim doc1 As notesdocument ' temporary (next) document Dim ndc As notesdocumentCollection Set ndb=ses.CurrentDatabase Set ndc = ndb.Unprocesseddocuments Set doc = ndc.getFirstDocument do while not doc is nothing set doc1 = ndc.getNextDocument (doc) If deleteNostub(doc) Then Print "Delete OK..." Else Print "Delete Failed..." End If Set doc = doc1 Loop End Sub ' * * * * * * * * END (Method) [INITIALIZE] ' * * * * * * * * ' * * * * * * * * START (Method) [DELETENOSTUB] ' * * * * * * * * ' * ' * delete document leaving no stub ' * Public Function deleteNostub (doc As Notesdocument) Dim path As String, noteid As Long, dbPath As String*MAXPATH, hdb As Long Dim ndb As Notesdatabase Set ndb = doc.parentDatabase dbPath = String$(MAXPATH, Chr(0)) noteID = Val("&h" &doc.Noteid) If W32_OSPathNetConstruct ("",ndb.Server, ndb.FilePath, dbPath)=0 Then If W32_NSFDbOpen (dbPath, hdb)=0 Then If hdb=0 Then Exit Function W32_NSFNoteDelete hDb, noteid, UPDATE_NOSTUB W32_NSFDbClose hdb deleteNostub = True End If End If End Function ' * * * * * * * * END (Method) [DELETENOSTUB] ' * * * * * * * * ' * * * * * * * * END (Function library) [DELETE NOSTUB] ' * * * * * * * *