Create NotesNewsletter

Hi,

I want to do the multi database search and to show the result in only one notesnewsletter. My existing script is running to create a newsletter for every loop. Is it possible to create only one notesnewsletter at the end of the loop with all the database search result. Below is the script :-

Dim session As New NotesSession

Dim ws As New NotesUIWorkspace

Dim db As NotesDatabase

Dim dc As NotesDocumentCollection, dbdc As NotesdocumentCollection

Dim doc As NotesDocument, dbdoc As NotesDocument

Dim news As NotesNewsletter

Dim vw As NotesView

Dim uidoc As NotesUIDocument

Dim dbDir As NotesDbDirectory

Set db = session.CurrentDatabase

Set uidoc = ws.Currentdocument

Set vw = db.getview(“Configuration By Type”)

svr$ = db.Server

query$ = uidoc.FieldGetText(“Search”)

If query$ = “” Then Exit Sub

query$ = “”“” & query$ & “”“”

Dim targetdb As New NotesDatabase(“”, “”)

Set dbdc = vw.Getalldocumentsbykey(“DB”)

Set dbdoc = dbdc.getfirstdocument

Do While Not dbdoc Is Nothing

dbname = dbdoc.DB_Name(0)

pth = dbdoc.DB_FilePath(0)

Set targetdb = session.getdatabase(svr$, pth & dbname)

Set dc = targetdb.FTSearch(query$, 0)

If dc.Count > 0 Then

 Set nc = New NotesNewsletter(dc)

 Call doc.AppendItemValue("Form", "Search Result")

 Set doc = nc.FormatMsgWithDoclinks(db)

 Call doc.AppendItemValue("Subject", "FT search for: " & query$)

 Call doc.Save(True, False)

End If

 Set dbdoc = dbdc.GetNextDocument(dbdoc)

Loop

Subject: RE: Create NotesNewsletter

I don’t believe you can do this, but NotesNewsletter is just a convenience class – it doesn’t do anything that you couldn’t do step by step using a NotesDocument and NotesRichTextItem, adding the text and doclinks yourself. And of course in that case, you can mix and match documents from any number of different databases. It all depends on your program logic.