Show ’n’ tell V: database properties

Show-n-tell Thursday logoFor this week’s show ’n’ tell I opted to re-visit an existing tip from way back, and expand upon it. The tip itself isn’t actually on (although it is referenced in my old article, Issues with code in R5), it’s on the developerWorks Lotus forum.

My original developerWorks post was a code snippet to restore a database’s launch properties (in some versions of R5, a Notes client crash would cause launch properties to be lost, and users might not have the right level of access to put them back manually). But this stuff has wider possibilities and is equally valid in later versions of Notes. Let me explain.

There are stacks of database properties that developers like to tinker with programmatically. But if you don’t do the C API, only a subset of these properties are available via Lotusscript or Java. As new releases of Notes are made, IBM usually make more of these attributes available to programmers, but there’s still a bit of a hole (and some settings may only be read-only).

As such, this is rather a “niche” tip, but there we go. Onwards. The trick with this is to gain access in your code to the NSF’s “icon” note. This is achieved easily:

Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim doc As NotesDocument

  Set db = session.CurrentDatabase
  ' This is the "icon" note
  Set doc = db.GetDocumentByID("FFFF0010")

Super. Now to add to the $Flags attribute of that note:

' YOUR_FLAG = flag value you want to set
  ' per the list you can download in this tip
  doc.~$Flags = doc.~$Flags(0) & YOUR_FLAG
  doc.Save True, False

So far so good, but what flag settings do what? Well, thanks to a number of people on the developerWorks forums, various lists are out there. I have attempted to put these all together, and you can grab it here. I haven’t tested the whole list, so if there are any errors, omissions, etc., then let me know.

Anyway, how about a simple example: say your administrator wants to enable LZW compression on a bunch of databases. Easy. Write an agent to loop through your specified directories, and add Z to each database icon’s $Flags field. Job done!

NOTE: you may need to tinker with other values in your database icon note. For example, say you switch on soft deletions using the $Flags setting “4”: you now need to specify what the soft deletion period should be. In this example, this value is written to a separate $ field in the icon design note, called $SoftDeleteExpireHours (I appreciate that this is a somewhat spurious example given that you can tweak these attributes via the NotesDatabase class nowadays).

To find out other $ field names (e.g. the name of relevant design element in the various database launch properties), look in the attached flags list or check out an example database using NotesPeek (look for the “Database Icon” design element).


  1. Hello Ben,

    Great tip. Do you (or anyone reading) know if there is a flag for replication settings?
    I would like to disable the Space Savers for all mail files, and this seems like the way to do it.Sanel Karagic#
  2. Sanel, I'd check the C API documentation.

    You won't find these flags in the icon note -- replication history and replication settings are multi-parameter configuration options, i.e. data structures too complicated to be stored in a simple $FLAGS field I would suggest.

    I used to have some code to query replication history from Lotusscript (via the Notes DLLs)… I'll see if that offers up any additional help for you. Put basically, if you can isolate the function calls you need in C, you can probably leverage them from Lotusscript. There are some tutorials out there for "converting" C API stuff to LS. It can be tricky, but isn't impossible (heck, I've done it).Ben Poole#

Comments on this post are now closed.


I’m a software architect / developer / general IT wrangler specialising in web, mobile web and middleware using things like node.js, Java, C#, PHP, HTML5 and more.

Best described as a simpleton, but kindly. You can read more here.