Finding which documents have been deleted from a database with a script solution


Notes 8.5 now has an extra column in the user activity pop up which shows deletions

I seem to have lost the comments somehow but several people recommended Ytrias (free ) tool over Notes Peek. I have tried it now and it is very good

I recently had a call from a customer to say that their application had stopped working. It turned out that a number of configuration documents had been inadvertently deleted when the user tried to archive off old documents – but which ones ?

One frustrating feature of Notes is that unless you code something special it is very difficult to find out who has deleted documents and when ( I now generally use a soft delete mechanism so that most users  cannot hard delete documents )

1) The first quick check is to look in the application properties – user activity and see if anyone has “written” a large number of documents.

Image:Finding which documents have been deleted from a database with a script solution

2) I then use a script to compare the documents in the “live” copy with the documents in a local replica or backup. This takes each document in the backup and tries to find the corresponding document in the live copy. If no matching document is found ( or just a deletion stub ) it puts that document in a folder so that I can copy it back to the live system ( note that the doc unid will change )

3) If I need to do further analysis to see when the document was deleted ( and indirectly by who using the logs ) I can now use the doc unid and NotesPeek to examine the deletion stub – I find that the search facility doesn’t always work so I tend to dump it to a text pad and search there

Image:Finding which documents have been deleted from a database with a script solution

This is the LotusScript code for step 2 ( also attached as an LSS )

‘check for deletions on the server:

Option Public
Option Declare ‘ because Rocky says you must

Sub Initialize

‘check for deletions on the server:
‘ Sean Cull,

‘ This agent compares two replicas and highlights documents that are in one
‘ replica but not the other. These documents are added to folders $4091_Deleted_Documents
‘, $missingdocuments or $zerolengthdocs for later examination

‘ the code is particularly usefull for finding what has been deleted from a replica

Dim ws As New notesuiworkspace
Dim session As New NotesSession
Dim thisdb As notesdatabase
Dim otherdb As notesdatabase
Dim coll As notesdocumentcollection
Dim thisdoc As notesdocument
Dim otherdoc As NotesDocument
Dim number_docs As Long
Dim var As Variant
Dim unidvar As String
Dim Error_4091_flag As Boolean

On Error Goto printerror        
On Error 4091 Goto error_4091
‘ error 4091 occurs when you use getdocumentbyunid on a deletion stub
‘ the error message is invalid universalid
‘ there are some support documents which also suggest that you sometimes do manage
‘ to get a handle on a stub so you also need to check if doc.size = 0

Set thisdb = session.CurrentDatabase
Set coll = thisdb.AllDocuments

number_docs = coll.count

Print “There are ” & Cstr(number_docs) & ” Documents to process”

‘variant = notesUIWorkspace.Prompt( type%, title$, prompt$ [, default ] [, values ] )
‘variant(0) = server
‘variant(1) = path
‘variant(2) = title

var = WS.Prompt( 13, “Choose the second database”, “”)

Set otherdb = Session.GetDatabase( var(0), var(1), False )
If Not otherdb.IsOpen Then
       Msgbox “Could not open the second database”
       Exit Sub
End If

Set thisdoc = coll.GetFirstDocument
Do Until thisdoc Is Nothing
       number_docs  =         number_docs  – 1
       Print         number_docs ‘ this slows things down but I find it useful
       unidvar = thisdoc.UniversalID
       error_4091_flag = False
       Set otherdoc = otherdb.GetDocumentByUNID(unidvar)
       If error_4091_flag Then ‘ a deletion stub
               Call thisdoc.putinfolder(“$4091_Deleted_Documents”,True)                                                
               If otherdoc Is Nothing Then
               ‘ a missing document as opposed to a deleted one
                       Call thisdoc.putinfolder(“$Missing_Documents”,True)                        
                       ‘ there is a document but we need to check if it is a zero length stub
                       If otherdoc.size = 0 Then Call thisdoc.putinfolder(“$Zerolengthdocs”,True)                        
               End If                        
       End If
       Set thisdoc = coll.GetNextDocument(thisdoc)

Exit Sub

Error_4091 :
error_4091_flag = True        
Resume Next


If (Err() <> 0) Then
       Messagebox( “Error” & Str(Err) & “: ” & Error$)
End If

Exit Sub

End Sub

ClipCache Pro (9/10)

I had mixed success with earlier versions of ClipCache Pro but this latest version seems to run really well under Vista.
It is great for improving your efficiency and generally making life easier – it is also occasionally useful for those moments when your brain becomes disengaged and you delete a mornings work

I Like

Ease of use, custom keyboard short cuts, images getting clipped as well, clean up tools to remove formatting

I Dislike

 Some common code I use to dump data to spreadsheets uses the clipboard, if you leave clipcache on you can easily get 1000 + new clips in its store !
Some crashes under XP

Image:ClipCache Pro (9/10)Image:ClipCache Pro (9/10)

Quick floating server console in client using AdminRemoteConsole

This is a feature that I use pretty much every day. The Command( [AdminRemoteConsole] ) can be used to open a floating i.e. non-modal server console in your client.

I use it on a smarticon as shown in the clip below. One of the best features is that you can copy the contents of the console to a clipboard for better analysis. It is much more convenient than using the Admin Client

Image:Quick floating server console in client using AdminRemoteConsole

Sametime 8 works well on Dual Monitors

I think that this is new in Sametime 8 – I certainly never noticed it before in previous versions

If you choose View > Maximise and have two monitors the shared screen appears on your second monitor leaving the Sametime interface still open in the Primary monitor. This lets you see chat and access the controls

I have often found Sametime disappointing and until I moved to Vista we tended to use MS Netmeeting over VPN between our offices to screen share peer to peer. With it not being possible to Netmeet between XP and Vista machines ( MS what were you thinking ? ) we upgraded our Sametime server and have been pleasantly surprised

As an aside you would think that the Lotus spell checker would recognise Sametime wouldn’t you !

Image:Sametime 8 works well on Dual Monitors

Toshiba M700 Tablet PC ( 7/10 ) Vista ( 3/10 )

Image:Toshiba M700 Tablet PC ( 7/10 )  Vista ( 3/10 )..I have been really looking forward to getting a Tablet PC for several reasons and in many ways have been very impressed with the M700 / Tablet PC expierience. I ordered on from the USA because Toshiba in the UK initially offered pretty low spec machines – pretty daft really since the USP of this machine is that it is a “Power Tablet”

While I do think that the Tablet PC has great potential using Vista has been quite painful with regular crashes – as in multiple times per day – and software that just stops. The machine was originally supplied with XP and I installed Vista Ultimate myself – I thought I had done a good job and down loaded and installed over 20 Toshiba utilities and drivers so it would be interesting to hear what other users with factory installed Vista have found.

OneNote – the MS note taking software has been a great experience

I will hopefully be writing much more about this in the future