Hi,My user in a different country says that some functionality I built for them works a lot faster with a local replica of our ‘Directory Services’ database, after I suggested they create a local to solve the performance issues.
But…now they want a nice button in email kind of way to create it, which does seem quite reasonable, who wants there user to have to enter a selection formula.
So…
I realised a nice easy way to create a replica stub…
-
Create Local Replica with Send and Receive documents unchecked;
-
Now I have a replica stub I can easily get on there workspace, just detach the .nsf file from an email and add the icon…
But…now I want to use the replica I created…I want to:
-
Set the Replication Formula
-
Ideally then, Replicate.
So I am trying to do 3) at the moment, using some LS I found on the forum. Its strange, debugging it everything is getting set correctly, and usually no error message occours (e.g. when not debugging), but when debugging the last save line is giving “Error accessing product object method”.
I’d ideally like to avoid scary API calls if possible, I like to keep it quite simple so I understand it…
One thought that does occour is, that maybe it doesnt work because it’s a stub? If so…then how can I create a local database with no documents in (thats the whole point, I don’t want to try and create a local with all documents even as part of the process, as this will be and is incredibly slow)
Here is the code; any ideas?
Sub Click(Source As Button)
Dim repDetails As NotesReplication
Dim repEntry As NotesReplicationEntry
Dim nc As NotesNoteCollection
Dim destDb As New NotesDatabase(“”,“”)
Dim noteId As String
Dim nextNoteID As String
Dim i As Integer
Dim repDoc As NotesDocument
Dim formulaChg As String
'// Get the database some how …
Call destDb .Open( “”, “dir.nsf” )
'// Get the replication settings
Set repDetails = destDb.ReplicationInfo
'// Get the replication details
Set nc = destDb.CreateNoteCollection(False)
nc.SelectReplicationFormulas = True
Call nc.BuildCollection
'// Step through the found design notes and get the associated replication entry
noteID = nc.GetFirstNoteId
'For i = 1 To nc.Count
nextNoteID = nc.GetNextNoteId(noteID)
Set repDoc = destDb.GetDocumentByID(noteID)
'// Get the notes replication entry
Set repEntry = repDetails.GetEntry(repDoc.GetItemValue(“$ReplSrcServers”)(0), repDoc.GetItemValue(“$TITLE”)(0), False)
formulaChg=|SELECT ("Select @Contains(CountryCode;“GB”:“IE”)|
repEntry.Formula = formulaChg
Call repEntry.Save
Call repDetails.Save
End Sub