Makgabo Lamola 15.Apr.05 10:31 AM a Web browser Lotus Domino Document Manager Desktop Enabler3.5Windows 2000
How do you use domino.doc api on the replica server to add documents on the replica server using api via an agent or so. I've written code to do that but the code always connect to the master server cabinet/binder even if my library object returns a replica library. Here is a sample code:
'=========='Declare Domino.Doc API objects
Dim objAPI As Variant
Dim objLibrary As Variant
Dim objCabinets As Variant
Dim objCabinet As Variant
Dim objBinders As Variant
Dim objBinder As Variant
Dim objDocument As Variant
Dim sLibURL As String
Dim i As Integer
Dim docCurr As NotesDocument
Dim unid As String
Dim sWebParms List As String
Set dbCurr = sessCurr.CurrentDatabase
Set docCurr = sessCurr.DocumentContext
Set docExtraSheet = GetNewInstance (unid)
Dim sServer As New NotesName (dbCurr.Server)
If Not ObtainProfileDocument (dbCurr,docProfile,"AngloPlatProfile") Then
Call FormatMSG (objCabinet,"Profile document not found, contact system administrator.")
Exit Sub
End If
Set vwGlobalProfile = dbCurr.GetView("(InternalAdmin)")
Set docGlobalProfile = vwGlobalProfile.GetDocumentByKey("GlobalProfile",True)
Set dbLibrary = sessCurr.GetDatabase(dbCurr.Server,docProfile.VaultFilename(0)) ''Library Database
Set vwReplicaInfo = dbLibrary.GetView("vaReplicaInfo")
Set docReplicaInfo = vwReplicaInfo.GetDocumentByKey(sServer.Canonical)
'Set API
Set objAPI = CreateObject("DominoDoc.API")
Call objAPI.SetHttpLogin (docProfile.SuperUserUserName(0),docProfile.SuperUserPassword(0))
sLibURL = "http://" + docReplicaInfo.HTTPHostName(0) + "/" + docProfile.VaultFilename(0)
Set objLibrary = objAPI.GetLibrary (sLibURL)
Set objCabinet = objLibrary.GetCabinetById (docGlobalProfile.FileCabinetUNID(0)
Set objBinder = objLibrary.GetBinderById (docGlobalProfile.FileCabinetUNID(0) + docExtraSheet.BinderID(0))
The lines above generate an error as the code tries to access the master server instead of accessing the server where the scripts is running. How do I instruct the code to use the replica server. This code is working fine on the master server.