About This Code
Brief Description:
Clear Lotus Notes local cache (cache.ndk) with LotusScript
Contributor:
Pascal LUCAS
Notes Version:
R6.x, R8.x, R5.x, R7.x
Last Modified:
03 Dec 2008
OpenNTF Disclaimer
All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.
Code / Description
Embed this LotusScript in a button or in the postopen sub of a database script. With it, users can clear their local caches without deleting their cache.ndk files.
Here is the code :
**************************
Dim WorkSpace As New NotesUIWorkspace
Dim DbCache As NotesDatabase
Dim AllDocs As NotesDocumentCollection
Dim Doc, nextDoc As NotesDocument
Dim i As Integer
On erreur Goto ErrorHandling
Set DbCache = New NotesDatabase ("", "cache.ndk")
Set AllDocs = DbCache.AllDocuments
If AllDocs.Count > 0 Then
Print "deleting documents from cache.ndk ..."
Set Doc = AllDocs.GetFirstDocument
While Not ( Doc Is Nothing )
i = i + 1
Set NextDoc = AllDocs.GetNextDocument ( Doc )
Print "deleting documents from cache (" & Cstr (i) & "/" & Cstr ( AllDocs.Count ) & ")"
Call Doc.RemovePermanently ( True )
Set Doc = NextDoc
Wend
End If
Print "Compacting cache.ndk"
Call DbCache.Compact
Exit Sub
ErrorHandling :
Resume
Call WorkSpace.Prompt (1, "Cache.ndk Optimization", "An error has occured." )
**************************
Pascal LUCAS.
http://www.upteamind.fr
Usage / Example