Notes api - help please!

I am really new to Notes API and I am trying to use the NSFDBGetOptions call to retrieve the DBOPTION_NO_BGAGENT value. Here’s what I have written so far:

Declarations

Const APIModule = “NNOTES” ’ Windows

Declare Function OSPathNetConstruct Lib APIModule Alias “OSPathNetConstruct” _

( Byval NullPort As Long, Byval Server As String, Byval FIle As String, Byval PathNet As String) As Integer

Declare Function NSFDbOpen Lib APIModule Alias “NSFDbOpen” _

( Byval PathName As String, DbHandle As Long) As Integer

Declare Function NSFDbClose Lib APIModule Alias “NSFDbClose” _

( Byval DbHandle As Long) As Integer

Declare Function NSFDbGetOptions Lib APIModule Alias “NSFDbGetOptions” _

( Byval DbHandle As Long, Options As Long) As Integer

Declare Function NSFDbSetOptions Lib APIModule Alias “NSFDbSetOptions” _

( Byval DbHandle As Long, DOpt As Integer, DbMask As Integer ) As Integer

Const DBOPTION_NO_BGAGENT = &H00000200

Initialize

Sub Initialize

Dim session As New NotesSession

Dim currentdb As NotesDatabase

Dim dbserver As String

Dim hDB As Long

Dim status As Long



Set currentdb = session.CurrentDatabase

dbserver = currentdb.Server

Set newdb = New NotesDatabase( dbserver, "test.nsf" )



p$ = String(1024, " ")

OSPathNetConstruct 0, dbserver, newdb.FilePath, p$ 

NSFDbOpen p$, hDB



If hDB = 0 Then

	Exit Sub

Else

	status = NSFDbGetOptions( hDB, DBOPTION_NO_BGAGENT )

	NSFDbClose hDB

End If	

End Sub

However, it doesn’t seem to return the value for me. For those of you who are very proficient in Notes API, I would really appreciate your assistance in helping me to identify what I am doing wrong. Thank you in advance.

Subject: NOTES API - HELP PLEASE!!!

Yes, it is working as designed (unless the HEX value for the constant has changed.) To set whatever properties you need to set, first make a call to the NSFDbSetOptions function and pass in what is needed, then use the NSFDbGetOptions to see if it is set properly.

SPJ

Subject: RE: NOTES API - HELP PLEASE!!!

Thanks for your assistance, but it’s not working. When I call the NSFDBSEtOPTIONs call first and then check the database properties on the database, the database property, “Disable Background Agents”, is not set. But, when I try to access the test database I created later, a command has been submitted to the server to delete the database and its no longer available. So, I’m not sure what’s going wrong.

Subject: NOTES API - HELP PLEASE!!!

Interesting issue. I, too, am using R6.5.x and I see it working sometimes and others not. I even wrote a small routine to extract if any errors were coming back (making sure “0” was the correct return code) and no errors were coming back. You may want to try an undocumented LS method (enableoptions(option%,boolean true|false)) to perform this operation. It’s syntax is db.enableoptions(xxx%,<true|false>).

Subject: see my previous answer

http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/1dcfe152ceee22b685257030006bf9ae?OpenDocument

Markus Seitz

markus.seitz@icodex.com

Subject: RE: see my previous answer

I did modify my agent using the API call, REPLFLG_NO_CHRONOS, and it worked perfectly. After carefully reading the DBOPTION_XXX flags, I realized that the DB_NO_BGAGENT API call only checks to see if any background agents are enabled. It does not set the properly, whereas the API call, REPLFLG_NO_CHRONOS, does set the property. So, I have it working now. Thanks to all.

Subject: NOTES API - HELP PLEASE!!!

Tracy, have you run your code through the debugger? I have tested your code with and without a background agent and the status return value is “0”. Run it through the debugger and see what you get.

SPJ

Subject: RE: NOTES API - HELP PLEASE!!!

Yes, I have and I get 0 also. I may be understanding this call. I am trying to set the property, Disable Background Agents, in a database and I thought this would do it. So, are you saying this is working properly?