Domino 9 und frühere Versionen > Entwicklung
Anhang von einem Dokument in ein anders kopieren
Semeaphoros:
Daniel, was sagt denn der Debugger? Und vielleicht fragst Du wie im Beispiel der Hilfe auch noch nach HasEmbedded ab
rar:
Im doc sehe ich unter EmbeddedObjects kein Inhalt obwohl doc.HasEmbedded True ist. Das $File Feld ist aber befüllt.
Mehr als ein Type mismach kommt beim Debugger nicht raus.
Hier ist der komplette Code:
Dim session As New NotesSession
Dim db As NotesDatabase
Dim coll As NotesDocumentCollection
Dim doc As NotesDocument
Dim docTmp As NotesDocument
Dim docNew As NotesDocument
Dim rtitem As NotesRichTextItem
Dim strTemp As String
strTemp = Environ("Temp") +"\c.daten.notes\"
Set db = session.CurrentDatabase
Set coll = db.UnprocessedDocuments
Set doc = coll.GetFirstDocument()
Do While Not doc Is Nothing
Set docTmp = coll.GetNextDocument(doc)
Set docNew = db.CreateDocument()
docNew.Form = "mKonto"
If doc.HasEmbedded Then
Set rtItem = New NotesRichTextItem( docNew , "Body" )
Forall x In doc.EmbeddedObjects
If x.Type = EMBED_ATTACHMENT Then
Call x.ExtractFile( strTemp + x.Source )
Call rtItem.EmbedObject( EMBED_ATTACHMENT, "" , strTemp + x.Source )
End If
End Forall
End If
Call docNew.Save(True,True)
'call doc.Remove(true)
Set doc = docTmp
Loop
Driri:
--- Zitat ---Forall x In doc.EmbeddedObjects
--- Ende Zitat ---
Das ist wohl der Fehler. Korrekt wäre IMO :
Forall x in rtitem.EmbeddedObjects
koehlerbv:
--- Code: ---Set rtItem = New NotesRichTextItem( docNew , "Body" )
--- Ende Code ---
Das ist auch nicht richtig - damit erzeugst Du das fünfte Body-Item. Du musst schon GetFirstItem nehmen. Notes findet dann die Attachments schon.
Bernhard
rar:
:) DANKE :)
Ich habs.
Mit dem GetFirstItem hat Notes die Attachements gefunden und mit rtitem.EmbeddedObjects geht das Forall auch.
Mich wundert warum es mit doc.EmbeddedObject nicht funzt. Vielleicht ein Bug ?!
Set rtItem = New NotesRichTextItem( docNew , "Body" )
passt aber Bernhard. Das ist das einzige Bodyfeld in dem neuen Dokument.
Vielen Dank euch allen. Der Abend ist gerettet ;D
lG
-daniel
Navigation
[0] Themen-Index
[#] Nächste Seite
[*] Vorherige Sete
Zur normalen Ansicht wechseln