SnTT: Is database design hidden (Notes API Solution)
October 23, 2008 – 3:30 pmBernd Hort posted a tipp earlier today on how to programmatically check is the design of a database is hidden. Bernd said that there is no method in LotusScript to do such.
I did a little research and found an older DominoPower article. In Notes 5 IBM introduced some enhancements to the Notesreplication class. Amongst other methods and properties there was a HideDesign property. Anybody knows what has happened to this property?
And I found some Notes API calls to do the trick. I modified the code and here is my solution on how to programmatically check a databases design flag.
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 | Const APIModule = "NNOTES" ' Windows/32 only Const REPLFLG_HIDDEN_DESIGN = &H0020 Type ReplicaInfo ID(1) As Long Flags As Integer CutoffDays As Integer CutoffDate(1) As Long End Type Declare Function NSFDbOpen Lib APIModule Alias "NSFDbOpen" _ ( Byval P As String, H As Long) As Integer Declare Function NSFDbClose Lib APIModule Alias "NSFDbClose" _ ( Byval H As Long) As Integer Declare Function OSPathNetConstruct Lib APIModule Alias "OSPathNetConstruct" _ ( Byval Z As Long, Byval S As String, Byval F As String, Byval P As String) As Integer Declare Function NSFDbReplicaInfoGet Lib APIModule Alias "NSFDbReplicaInfoGet" _ ( Byval H As Long, R As ReplicaInfo) As Integer Declare Function NSFDbReplicaInfoSet Lib APIModule Alias "NSFDbReplicaInfoSet" _ ( Byval H As Long, R As ReplicaInfo) As Integer Function IsDesignHidden ( db As NotesDatabase ) As Boolean IsDesignHidden = False Dim hDB As Long Dim R As ReplicaInfo p$ = Space(256) OSPathNetConstruct 0, db.Server, db.FilePath, p$ NSFDbOpen p$, hDB NSFDbReplicaInfoGet hDB, R If ( Not R.Flags And REPLFLG_HIDDEN_DESIGN) = 0 Then IsDesignHidden = True End If NSFDbClose hDB End Function |
Now you can call the function. It will return true is design is hidden and false if the database has open design.
1 2 3 4 5 6 7 | Sub Click(Source As Button) Dim session As New NotesSession Dim db As NotesDatabase Dim rep As NotesReplication Set db = session.CurrentDatabase Msgbox IsDesignHidden(db) End Sub |





5 Responses to “SnTT: Is database design hidden (Notes API Solution)”
Are you able to unhide the design with this?
By Bruce on Oct 23, 2008
Unhiding a hidden design has been discussed numerous times in forums all aroung the Notes Planet. And even with this method you are not able to completely unhide the design.
Here is the attempt on LDD to hide/unhide the design by Rod Whiteley on 29.Oct.01 http://www-10.lotus.com/ldd/46dom.nsf/0/4835a87a39abcd5380256af400402cbe?OpenDocument
By Ulrich Krause on Oct 23, 2008
Ulrich,
Thanks for the reply. I don’t want to unhide a db design however, we sell some products with hidden design elements.
By Bruce on Oct 23, 2008
@Ulrich – There appears to be a small bug in the posted code. On line 30 you check for Flags > 0 to tell if the database is hidden. According to the api, there are many different non-zero values that can be stored in the Flags member. For example, if replication is disabled for the database, the Flags member will have the value REPLFLG_DISABLE (&h004) set in addition to anything else that may be set. Long story short, I think you want to rewrite the test to be (Flags And REPLFLG_HIDDEN_DESIGN)
@Bruce – once the design is hidden, the Formula is encrypted and the LotusScript source is deleted. These cannot be undone by turning off this flag in the replication flags. All the flag does once the design is hidden the first time is cause designer to not show the ‘Open in Designer’ menu item. It will still not prevent someone from seeing the design with other tools like NotesPeek or something similar.
By Craig Schumann on Oct 23, 2008
@Craig: I’ ve fixed it in the code.
By Ulrich Krause on Oct 24, 2008