Domino 9 und frühere Versionen > ND6: Entwicklung

Leserfeld im Nachhinein einfügen

(1/2) > >>

RvM:
Wie kann ich per Agenten im Nachhinein en Leserfeld mit einem entsprechenden Wert Dokumenten in einer DB zuweisen?

klaussal:
Lies mal in der Hilfe die "IsReaders"-Property durch.

In der Notes Programming Bible steht auf Seite 287 ein Beispiel.
Beispiel für Autoren-Feld:

--- Code: ---Dim doc....
dim authoritem as NotesItem
dim alist(0 to 1) as string

alist(0) = session.UserName
alist(1) = "[DeineRolle]"

set doc = ...
set authoritem = doc.ReplaceItemValue (....
authoritem.isAUthors = True
call doc.save......


--- Ende Code ---

RvM:
OK, habe mal folgendes Script gebastelt:
   Dim Session As New NotesSession
   Dim db As NotesDatabase
   Dim coll As NotesDocumentCollection
   Dim loopdoc  As NotesDocument
   Dim item As NotesItem
   
   Set db = session.CurrentDatabase
   Set coll = db.UnprocessedDocuments
   Set loopdoc = coll.GetFirstDocument
   While Not(loopdoc Is Nothing)
      Set item = New NotesItem( loopdoc, "werdarf", "[STH]:[BOZ]:[ASH]:[Admin]", READERS )   
      item.IsReaders= True
      Call loopdoc.Save(True,True,True)               
      Set loopdoc = coll.GetNextDocument(loopdoc)
   Wend
ist ja alles okay, bis, das das Feld "werdarf" keine Textliste ist.

Driri:
Das ist klar, Du übergibst das ja auch als einen String.

Versuchs mal so :

Set item = New NotesItem( loopdoc, "werdarf", "[STH]":"[BOZ]":"[ASH]":"[Admin]", READERS )   

Das war Müll.

klaussal:
Oder so:

dim werdarf(0 to 5) as string

werdarf(0) = "[STH]"
werdarf(1) = "[BOZ]"
werdarf(2) = "[ASH]"

..... usw

Hat den Vorteil, dass, wenn man das mehrmals benutzt, nur an einer Stelle ändern muss.

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln