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();


Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top