Domino 9 und frühere Versionen > ND7: Entwicklung

Position für Methode CopyItemtodocument festlegen

(1/1)

zyrak2003:
Liebe Kolleginnen und Kollegen,

ich brauche dringend eure Hilfe für eine kleine Scriptherausforderung. Im Folgenden Script öffne ich eine Antwortmail, und möchte in diese ein NotesItem einfügen. Das klappt auch soweit, allerdings soll das NotesItem nicht ans Ende des Bodyfelds kopiert werden sondern an den Anfang.

Der Befehl Call item.CopyItemToDocument(replyMail,"Body") klebt den Feldinhalt direkt hinter den Text der Ursprungsmail.


Sub Click(Source As Button)
   Dim ws As New NotesUIWorkspace
   Dim s As New NotesSession
   Dim db As NotesDatabase, dbMail As NotesDatabase
   Dim uidoc As NotesUIDocument
   Dim doc As NotesDocument, docMail As NotesDocument, replyMail As NotesDocument, docProfile As NotesDocument
   Dim item As NotesItem
   
   ws.ReloadWindow
   ws.ViewRefresh
   Set db=s.CurrentDatabase
   Set uidoc=ws.CurrentDocument
   Set doc=uidoc.Document
   
   
   Set docProfile=db.GetProfileDocument("DBProfile")
   Servername=docProfile.Mails1Server(0)
   DBname=docProfile.Mails1DB(0)
   
   Set dbMail=s.GetDatabase(Servername,DBName)
   
   If doc.MailID(0) = "" Then
      Exit Sub
   End If
   
   Set docMail = dbMail.GetDocumentByUNID(doc.Mailid(0))
   Set replyMail = docMail.CreateReplyMessage(False)
   
   replyMail.From = "Absender xy"
   replyMail.SendTo = doc.MailAddress(0)
   replyMail.Subject = "Antwort: " & doc.MailThema(0)
   Set item = doc.GetFirstItem( "Ausgangsmail" )
   Call item.CopyItemToDocument(replyMail,"Body")
   
   Call replyMail.Save( True, True )
   
End Sub

Hat jemand eine zündende Idee?

Liebe Grüße
zyrak2003

Bastel123:
Schau dir mal die Klasse NotesRichTextNavigator und dort die Methode SetPosition an.

Vielleicht hilft das.

Gruß
Sebastian

Tode:
CopyItemToDocument ist die falsche Methode. Nimm ein NotesRichtextItem und füge dort per AppendText den Text ein... dann kannst Du -wie von Sebastian beschrieben- mittels NotesRichtextNavigator die Position bestimmen. Also so:

--- Code: ---Dim body as NotesRichtextItem
Set body = New NotesRichtextItem( replyMail, "Body" )

... Hier die Position festlegen mittels Navigator
Call body.AppendText( item.Values )

Oder: Wenn "Ausgangsmail" ein Richtextitem ist:

Call body.AppendRichtextItem( item )

--- Ende Code ---

Navigation

[0] Themen-Index

Zur normalen Ansicht wechseln