Domino Code Fragment

Code Name*
How to Fill a Reader Field with Multiple Names via LotusScript
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.18.117.111.1
Description*
Use the AppendToTextList method of the NotesItem field to Fill a Reader Field with Multiple Names via LotusScript
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
PROBLEM:

Via LotusScript, how can you create multiple restrictions in a new
document?  How can you give more than one user access to a document that is
created via LotusScript?


If you use the following syntax to set a multi-value field, the names are
not considered separate values until the document is opened and re-saved.


  doc.ReadersField = "CN=Your Name/Ou=Your Unit/O=Your
 Organization,CN=Another Name/Ou=Your Unit/O=Your Organization"


SOLUTION:

Use the AppendToTextList method of the NotesItem field.  Note that you must
use an Append for each name.  For three names, for example, you need three
calls.


Sample Script:

     Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim doc As NotesDocument    
         Dim item As Variant    
   
    ' ... Set all needed value ...
    Set item=doc.APPENDITEMVALUE("ReadersField","")
    item.APPENDTOTEXTLIST("     CN=Your Name/Ou=Your Unit/O=Your
    Organization     ")
    item.APPENDTOTEXTLIST("     CN=Another Name/Ou=Your Unit/O=Your
    Organization     ")
    item.ISREADERS=True