Domino 9 und frühere Versionen > ND6: Entwicklung

Memo-Body-Feld füllen im Backend....

<< < (4/5) > >>

jor:
Hier der Code:
Sub Click(Source As Button)
   Dim ws As New NotesUIWorkspace
   Dim session As New NotesSession
   Dim maildb As New NotesDatabase( "", "" )   
   
   Dim uidoc As NotesUIDocument            'Aktuelles Angebotsformular
   Dim mail As NotesDocument       ' Memo im Backend
   Dim doc As NotesDocument               'Aktuelles Doc im Backend   
   Dim body As Variant   
   Dim container As Variant
   
   Set uidoc=ws.CurrentDocument            'Übernehme aktuelles Angebotsformular
   Call uidoc.Save( )
   Set doc = uidoc.Document
   Call doc.Save( True, True )   'Doppeltes Speichern...
   
   Call maildb.OpenMail   'Öffnen der Maildatei   
   Dim uimail As NotesUIDocument         'Aktuelles/neues Mailformular
   
   Set container = doc.GetFirstItem( "Body" )
   
   Set mail = maildb.CreateDocument( )
   mail.Form = "Memo"
   Call mail.ComputeWithForm(True,True)
   
   Call mail.Save( True,True )
   Set body = mail.GetFirstItem( "Body" )
   Call body.AppendRtItem( container )       'Soll den Wert aus Container in Body schreiben,
                                                'später per Schleife mehrere Inhalte einfügen
   
   Set uimail = ws.EditDocument( True, mail )
End Sub

diali:
änder mal die Reihenfolge. Save sollt kurz vor dem Öffnen des UI-Dokumentes erfolgen.

Set mail = maildb.CreateDocument( )
mail.Form = "Memo"
Set body = mail.GetFirstItem( "Body" )
Call body.AppendRtItem( container )       'Soll den Wert aus Container in Body schreiben,
                                                'später per Schleife mehrere Inhalte einfügen
   
Call mail.ComputeWithForm(True,True)
Call mail.Save( True,True )
Set uimail = ws.EditDocument( True, mail )

jor:
Danke, ich probiere es sofort aus!

jor:
Haut nicht ganz hin, das Body-Item wird nicht gefüllt. So wie ich es gesehen habe, kann das Body-Feld aus dem Document mail (mail.getfirstitem("Body")) nicht referenziert werden. Im Debugger wird das Bodyfeld unter Items im document mail nicht aufgeführt. Es existiert nicht.

diali:
Du machst ein
Dim body As Variant
benutze dafür
dim body as NotesRichTextItem

Erstelle das NotesRichTextItem body neu mit
Set body = mail.CreateRichTextItem( "Body" )

Navigation

[0] Themen-Index

[#] Nächste Seite

[*] Vorherige Sete

Zur normalen Ansicht wechseln