Clearing cache.ndk with Lotusscript

Clearing cache.ndk with Lotusscript

Messagepar UPTEAMIND » 02 Déc 2008 à 18:14

Hi,

I've recently posted a script on searchdomino.com.

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.

http://searchdomino.techtarget.com/tip/ ... 11,00.html

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

Call WorkSpace.Prompt (1, "Cache.ndk Optimization", "Optimization ended with success. Ypu should restart Lotus Notes." )

Exit Sub

ErrorHandling :
Resume
Call WorkSpace.Prompt (1, "Cache.ndk Optimization", "An error has occured." )
**************************

Pascal LUCAS
http://www.upteamind.fr
UPTEAMIND
Découvre Dominoarea
Découvre Dominoarea
 
Message(s) : 1
Inscrit(e) le : 17 Déc 2007 à 10:26
Localisation : PARIS

Messagepar Jérome Deniau » 02 Déc 2008 à 20:56

Jérome Deniau
 


Retour vers Divers