GetOption was introduced to the NotesDatabase class in V6. It allows to determine, if specific options are set or not.
By design, it only accesses $dboptions1 from the database. Other options are stored in $dboptions2 – 4.
Those option bits are not accessible using NotesDatabase.getOption(optionName%).
Here is code to access them.
Public Type DBOPTIONS
options (3) As Long
End Type
Public Const W32_LIB = {nnotes.dll}
Public Const TUX_LIB = {libnotes.so}
Declare Function W32_NSFDbGetOptionsExt Lib W32_LIB Alias {NSFDbGetOptionsExt}_
(ByVal hdb As Long, retDbOptions As DBOPTIONS) As Integer
Declare Function W32_NSFDbOpen Lib W32_LIB Alias {NSFDbOpen}_
(ByVal dbName As String, hDb As Long) As Integer
Declare Function W32_NSFDbClose Lib W32_LIB Alias {NSFDbClose}_
(ByVal hDb As Long) As Integer
Declare Function TUX_NSFDbGetOptionsExt Lib TUX_LIB Alias {NSFDbGetOptionsExt}_
(ByVal hdb As Long, retDbOptions As DBOPTIONS) As Integer
Declare Function TUX_NSFDbOpen Lib TUX_LIB Alias {NSFDbOpen}_
(ByVal dbName As String, hDb As Long) As Integer
Declare Function TUX_NSFDbClose Lib TUX_LIB Alias {NSFDbClose}_
(ByVal hDb As Long) As Integer
Public Function NSFDbGetOptionsExt (hDb As Long, retDbOptions As DBOPTIONS)
If isDefined("WINDOWS") Then
NSFDbGetOptionsExt = W32_NSFDbGetOptionsExt(hDb, retDbOptions)
Else
NSFDbGetOptionsExt = TUX_NSFDbGetOptionsExt(hDb, retDbOptions)
End If
End Function
Function NSFDbOpen( db As string, hDB As Long) As Integer
If isDefined("WINDOWS") Then
NSFDbOpen = W32_NSFDbOpen(db,hDb)
Else
NSFDbOpen = TUX_NSFDbOpen(db,hDb)
End If
End Function
Function NSFDBClose (hDb As Long)
If isDefined("WINDOWS") Then
NSFDbClose = W32_NSFDbClose(hDb)
Else
NSFDbClose = TUX_NSFDbClose(hDb)
End If
End Function
Sample:
Const DBOPT_IS_IMAP = &h01000000
Sub Initialize
Dim hDb As Long
Dim rc As Integer
Dim sDb As String
Dim retDbOptions As DBOPTIONS
sDb = "serv01/singultus!!mail/buser.nsf"
rc = NSFDbOpen(sDb, hDb)
If rc = 0 Then
rc = NSFDbGetOptionsExt (hDb, retDbOptions)
If retDbOptions.options(1) And DBOPT_IS_IMAP Then
MsgBox "IMAP enabled"
Else
MsgBox "IMAP not enabled"
End If
rc = NSFDbClose(hDb)
End If
End Sub
I have created an enhancement request for an optional method parameter to access the different optionsStores.
If you think, that this might give you some benefit, pls upvote my idea https://domino.ideas.aha.io/ideas/DDXP-I-508
Hi Ulrich, would be great to find a documentation which options you can get using the NSFDbGetOptionsExt function, do you have a list of them ? Thank you, Alex
Using this (undocumented) C API method in Domino JNA as well (plus a method to change them):
Method to read options
https://github.com/klehmann/domino-jna/blob/master/domino-jna/src/main/java/com/mindoo/domino/jna/NotesDatabase.java#L3265
All available DB options as Java enums
https://github.com/klehmann/domino-jna/blob/master/domino-jna/src/main/java/com/mindoo/domino/jna/constants/DatabaseOption.java
All DB options as constants
https://github.com/klehmann/domino-jna/blob/master/domino-jna/src/main/java/com/mindoo/domino/jna/internal/NotesConstants.java#L1377
Karsten, thank you very much – great reply with all I need to know !
(was looking and hoping for a flag to check if the OO Agent / Service is enabled – and I got it, easier than checking the profile document).
Best regards !