Access NotesDatabase Options (extended)

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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