Hi All,I tried to use openbyreplicaid in lotusscript, I tried the codes from design help:
Dim db As New NotesDatabase( “”, “” )
If db.OpenByReplicaID( “Moscow”, “85255FA900747B84” ) Then
Print( db.Title & " was successfully opened" )
Else
Print( “Unable to open database” )
End If
I changed the server of the database and replicaid on the code with the one I do not have access to test. But I can not get the print statement executed. Instead I got notes generated error message something like: “…do not access to database…”.
The codes popup that message right away, does not even wait the “false” return.
Subject: Problem of using Openbyreplicaid, help please.
the above code works fine for me just like it is, attempts to open db on server Moscow and prints “unable to open database” to the status bar. also changed the server to a server here that I don’t have acces to, same result. Also changed to a server I do have access to but the db does not exist, same result.
Subject: RE: Problem of using Openbyreplicaid, help please.
Yes, if you just run that exact code on help, it works.But if you change the server name and replicaid with an existing one which you know you do not have access, then you will not get the print statement. I have tried it.
Subject: RE: Problem of using Openbyreplicaid, help please.
Thanks a lot for the quick response,Could you change the server name and replicaid with the existing one, can you see the same result? Do not just change the server name, you have to change the associated replica id as well to test. I am sure you will get the same as mine.
Basically I want to find the code to check whether user have access to an specific notes database.
Subject: RE: Problem of using Openbyreplicaid, help please.
I have run into this problem, and found a workaround.
If you have a routine looping through databases (whether opening by replicaid or by name) and it gets to one it can’t open due to database security, you get a pop-up that ends the agent, and no amount of error trapping seems to help. The solution is to do the db open in a subroutine Funtion. The security error will end the Function, but not the agent.
So your code would be something like:
Sub Initialize
Forall repid in idlist
Set db = OpenDB (repid)
If not (db is nothing) then
… do something with db
End If
End Sub
Function OpenDB ( replicaid as string) as NotesDatabase
Subject: RE: Problem of using Openbyreplicaid, help please.
just trap the error:
Dim db As New NotesDatabase( "", "" )
On Error 4060 Goto skipdb
If db.OpenByReplicaID( "Moscow", "852573F40057AC90" ) Then
Print( db.Title & " was successfully opened" )
Else