Set Favorites Bookmark in BackEnd

Hi to all,I need to add in back-end from my agent in the “bookmark favorites” 10 Db on my customer.

So that I have realized this code in agent that you can choose the DB and in back add to a “favorites bookmark” :


    Dim outline As NotesOutline

Dim NewOE As NotesOutlineEntry

Dim Favorites As NotesOutlineEntry

Dim s As New NotesSession

Dim db As NotesDatabase

Dim wks As New NotesUIWorkspace

Dim dbDest As NotesDatabase

Dim session As New NotesSession

Dim PathDbDest As Variant



Set db = New NotesDatabase( "", "bookmark.nsf" )

Set outline = db.GetOutline("UserBookmarkOrder")



Set Favorites=outline.GetFirst



Do While Not(Favorites Is Nothing) 

	If  Favorites.Alias="$Favorites" Then

		Exit Do

	End If

	

	Set Favorites=outline.GetNext(Favorites)

Loop



PathDbDest = WKS.Prompt( 13, "Database da Importare", "Scegli il database da importare e premi ok" ,, )



Set DbDest=session.GetDatabase(PathDbDest(0),PathDbDest(1))

Set NewOE = outline.CreateEntry("Testing...",favorites,True,True)

Call NewOE.SetNoteLink(DbDest)

NewOE.Label=DbDest.Title

NewOE.ImagesText = "$Icon"



Call outline.save()

But I need to restart lotus notes client for see the new database.

There are a workaround?

I see that in the bookmark.nsf there are a folder “Favorite Bookmarks” with this infomation ( I have create in onother DB a FORM with the same fields of this folder so that I can see the content):

“URLIcon” → RichText ( but If I see this field in my custom DB or see this field in SCANDEZ I don’t see any content)

“Title” → Field Text ( I see this information in other DB )

“Site”–> Field Text ( Ok I see this information)

“URL”–> RichText ( but If I see this field in my custom DB I don’t see any content)

Someone can suggest me ?

Subject: Solved

In R8 there are a new function in a class workspace named “OutlineReload” so that in the last line of my code I insert:

Call wks.OutlineReload( “UserBookmarkOrder”, “bookmark.nsf”)

Subject: Cache Problem…

My solution work very well only the first time that I open the client…If I re-use my code…all work…but in my “favorites bookmarks” I see the old DB.

This is a cache Problem because if I use a

Basic Version of Notes 8 and I click on the sort option of my “favorites bookmarks” I see the update.

If I use a Standard Version of Notes 8 I don’t see any option for sorting so that I see the Old DB cached.

I try to delete from my bookmark.nsf and cache.ndk from the view “ByUrl” all documents…But I don’t resolve my problem.

Someone can help me?

Subject: Clear cache.ndk with lotusscript

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/0,289483,sid4_gci1340011,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