I have to develop an agent which have to collect all the Templates on each server. I am storing all the Server Names in a View by name “Server Names” and I am accessing the Server Name one by one and I am accessing all the Templates which is on that server. But some templates are missing when I am doing with the following script.
Following is the Script which I’m using.
Sub Initialize
Dim Session As New NotesSession
Dim ThisDb As NotesDatabase
Dim TempDb As NotesDatabase
Dim DbDir As NotesDbDirectory
Dim ServerView As NotesView
Dim ServerDoc As NotesDocument
Dim Doc As NotesDocument
Dim ServerName As String
Dim ServName As NotesName
Set ThisDb = Session.CurrentDatabase
Set ServerView = ThisDb.GetView("Server Names")
Set ServerDoc = ServerView.GetFirstDocument
While Not ServerDoc Is Nothing
Set ServName = Session.CreateName(ServerDoc.ServerName(0))
ServerName = ServName.Abbreviated
Set DbDir = Session.GetDbDirectory(ServerName)
Set TempDb = DbDir.GetFirstDatabase(1248)
While Not TempDb Is Nothing
Set Doc = ThisDb.CreateDocument
Doc.Form = "Tmpl Collection Form"
Doc.Title = TempDb.Title
Doc.Server = TempDb.Server
Doc.FilePath = TempDb.FilePath
Doc.RepID = TempDb.ReplicaID
Doc.TemplateName = TempDb.DesignTemplateName
Call Doc.Save(True,False)
Set TempDb = DbDir.GetNextDatabase
Wend
Set ServerDoc = ServerView.GetNextDocument(ServerDoc)
Wend
End Sub
Could any one help me to get all the templates.
Thanks In Advance