Hello All,
I am writing a Lotus Script which can copy all the groups from source NAB on source server to the destination NAB on destinations server.
I have put my lotus script which does it below.
This script is working fine, but I have a design problem in this:
Assume I schedule this script on domino server which will keep copying the groups, who will take care of presence of groups on the destination db/server. Do i have to do a check for this in my script or i can straight away copy it.
I mean to ask is…
a. Assume today I run this script and it copied 3 groups from source db on source server to dest. db on dest. server.
b. Now assume on the next day this script runs again, and assume that there are no new groups on source db, then will it copying create duplicate groups on dest. db on dest. server.
What is happening now is when I run the script for the ffirst time all is working fine.
If I run it for second time, the groups gets duplicated and If I run the same script again, I see 3 sets of same group.
I need to solve this issue. If I keep doing a search for each document i copy in the destination NAB, it going to be a BIG perfomrmance issue. There are more than 2500 groups in the setup on which I am running this script. I want to schedule this script as a Lotus Notes Agent, so that the groups updations can be synchronized with the dest. db on dest. server.
'=========================================================================================================================
Sub Initialize
Dim session1 As New NotesSession
Dim sourcedb As NotesDatabase
Dim sourceView As NotesView
Dim docSource As NotesDocument
Dim session2 As New NotesSession 'Used two session objects because the dest. db is on different server, but this script is written using one server 'only.
Dim destdb As NotesDatabase
Dim docDest As NotesDocument
Set sourcedb = session1.GetDatabase(“SSPDV370/SP/SD_DV”, “names.nsf”) 'DEV
If Not sourcedb.IsOpen Then
Print "IDMS Agent Error : Database names.nsf not found on SSPDV370/SP/SD_DV server" + Now
End If
Set destdb = session2.GetDatabase(“SSPDV370/SP/SD_DV”, “studentgroups.nsf”) 'This server could be different, for testing I have kept it same.
If Not destdb.IsOpen Then
Print "IDMS Agent Error : Database studentgroups.nsf not found on SSPDV370/SP/SD_DV server" + Now
Else
'Copy Internal Groups
Set sourceView = sourcedb.getView("SPAutoGroups - A")
If sourceView Is Nothing Then
Print "IDMS Agent Error : No group documents found in the names.nsf"
Else
Set docSource = sourceView.GetFirstDocument
While Not docSource Is Nothing
Set docDest = New NotesDocument(destdb)
Call docSource.CopyAllItems(docDest, True)
Call docDest.Save( True, True)
Set docSource = sourceView.GetNextDocument(docSource)
Wend
End If
End If
Exit Sub
'=========================================================================================================================
Any help would be greatly appretiated
thanks
SR