Setting Names, Readers and Authors the ODA Way

  |   Blog   |   No comment

No matter how long you work with an API, there can still be surprises. Yesterday proved one of those for me. While troubleshooting an issue for someone with setting an Authors field in a document (it turned out there was an obscure bug that meant it was trying to recycle a String in a Vector), I shared two ways I’ve been setting Readers or Authors fields in an application using OpenNTF Domino API for a while. Then this conversation ensued:

This is, without doubt, the recommended way of creating Names, Readers and Authors fields. The syntax, as I’ll show in my session at IBM Connect, would be:

  1. NamesList<String> names = new NamesList<String>();
  2. names.add(“CN=My Name/O=MyOrg”);
  3. newDoc.replaceItemValue(“Names”, names);
  4. AuthorsList<String> authors = new AuthorsList<String>();
  5. authors.addAll(names);
  6. newDoc.replaceItemValue(“Authors”, authors);
  7.         ReadersList<String> readers = new ReadersList<String>();
  8. readers.addAll(names);
  9. newDoc.replaceItemValue(“Readers”, readers);

Please bear in mind that in ODA 3.1.0 and earlier versions, although NamesList etc extend ArrayList<String> and the methods used only accept Strings, the class signature doesn’t specify as a String. So when declaring the Lists as in line 1, for anything prior to 3.2.0 will need to be :

NamesList names = new NamesList();


AUTHOR - Paul Withers

Paul Withers is an IBM Lifetime Champion, has been an OpenNTF Board Member since 2013, has worked with Domino since R4.5, XPages since 2009, co-authored XPages Extension Library and was technical editor for Mastering XPages 2nd Edition. He is one of the developers on OpenNTF Domino API as well as contributor to a variety of other OpenNTF projects. For full bio, see

No Comments

Post A Comment