| Option Public |
| Option Declare |
| |
| Const wAPIModule = "nnotes.dll" ' Windows/32 (Intel) |
| |
| 'Liste der API-Module anderer Systeme: |
| 'Const wAPIModule = "anotes.dll" ' Windows/32 (Alpha) |
| 'Const wAPIModule = "Inotes.dll" ' OS/2v1, OS/2v2 |
| 'Const wAPIModule = "libnotes_r.a" ' UNIX (AIX) |
| 'Const wAPIModule = "libnotes" ' OS/390 |
| 'Const wAPIModule = "libnotes.so" ' UNIX (Solaris, Linux) |
| 'Const wAPIModule = "libnotes.sl" ' UNIX (HP-UX) |
| 'Const wAPIModule = "NotesLib" ' Macintosh |
| 'Const wAPIModule = "/qsys.lib/qnotes.lib/libnotes.svrpgm" ' OS/400 |
| |
| Const NOTE_ADDED_TO_FILE = 13 |
| |
| Declare Private Function ConvertTIMEDATEToText Lib wAPIModule Alias "ConvertTIMEDATEToText" _ |
| ( Byval zI As Long, Byval zT As Long, T As Long, Byval S As String, Byval nS As Integer, nT As Integer) 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 NSFNoteOpen Lib wAPIModule Alias "NSFNoteOpen" _ |
| ( Byval hDB As Long, Byval NoteID As Long, Byval F As Integer, hNT As Long) As Integer |
| |
| Declare Private Function NSFNoteClose Lib wAPIModule Alias "NSFNoteClose" _ |
| ( Byval hNT As Long) As Integer |
| |
| Declare Private Function NSFNoteGetInfo Lib wAPIModule Alias "NSFNoteGetInfo" _ |
| ( Byval hNT As Long, Byval M As Integer, V As Any) As Integer |
| |
| Declare Private Function OSPathNetConstruct Lib wAPIModule Alias "OSPathNetConstruct" _ |
| ( Byval zP As Long, Byval S As String, Byval F As String, Byval N As String) As Integer |
| |
| Function AddedToFile(doc As NotesDocument) As String |
| |
| Dim db As String |
| With doc.ParentDatabase |
| db$ = String$(1024, " ") |
| OSPathNetConstruct 0, .Server, .FilePath, db$ |
| End With |
| |
| Dim hDB As Long |
| NSFDbOpen db$, hDB |
| If hDB = 0 Then Exit Function |
| |
| Dim hNT As Long |
| Dim T(1) As Long |
| NSFNoteOpen hDB, Clng("&H" & doc.NoteID), 0, hNT |
| If Not hNT = 0 Then |
| NSFNoteGetInfo hNT, NOTE_ADDED_TO_FILE, T(0) |
| NSFNoteClose hNT |
| Dim s As String |
| s$ = Space(80) |
| Dim ns As Integer |
| ConvertTIMEDATEToText 0, 0, T(0), s$, 80, ns% |
| AddedToFile = Left$(s$, ns%) |
| End If |
| |
| NSFDbClose hDB |
| |
| End Function |
| |
| Sub Initialize |
| |
| Dim s As New NotesSession |
| Dim cdb As NotesDatabase |
| Dim view As NotesView |
| Dim doc As NotesDocument |
| Dim rmcol As NotesDocumentCollection |
| Dim deadline As NotesDateTime |
| Dim docadded As NotesDateTime |
| Dim difference As Long |
| Dim retval As Integer |
| |
| Set cdb = s.CurrentDatabase |
| Set view = cdb.GetView( "<Ansicht mit gewünschten Dokumenten>" ) |
| Set doc = view.GetFirstDocument |
| Set rmcol = cdb.GetProfileDocCollection( "" ) |
| Set deadline = New NotesDateTime( "<Zeitpunkt der Replizierung aus Log>" ) |
| |
| While Not doc Is Nothing |
| |
| Set docadded = New NotesDateTime( AddedToFile(doc) ) |
| |
| difference = deadline.TimeDifference( docadded ) / 60 ' Timediefference in minutes |
| |
| If difference >= 0 And difference <= 60 Then ' Add doc to col if added within an hour before deadline |
| Call rmcol.AddDocument(doc) |
| End If |
| |
| Set doc = view.GetNextDocument(doc) |
| |
| Wend |
| |
| retval = Msgbox( "Möchten Sie wirklich " + Cstr(rmcol.Count) + " Dokumente löschen?", 36 , cdb.Title ) |
| If retval = 6 Then Call rmcol.RemoveAll(True) |
| |
| End Sub |
| |