Das Notes Forum
Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: marhaxus am 15.05.02 - 14:00:14
-
Hallo zusammen!
Gibt es irgendeine Möglichkeit in LS ein File-Attachment von einem Dokument in ein anderes (bestehendes) zu kopieren?
Danke!
-
Hier quick and dirty eine Sub, die alle felder eines Docs incl Attachments in ein Zieldokument kopiert
Sub CopyAllDocItems(Source As notesdocument, dist As notesdocument)
Dim rtitemA As Variant
Dim rtitemB As Variant
Forall i In Source.items
ItemName = i.name
If Not i.name = "$FILE" Then 'Takes care of where there is an attachment in RTF fields
If i.type = RICHTEXT Then
Set rtitemA = Source.GetFirstItem( i.Name)
Set rtitemB = New NotesRichTextItem ( Dist, i.Name )
Call rtitemB.AppendRTItem( rtitemA )
Else
Set notesItem = i.CopyItemToDocument( Dist, i.Name )
End If
End If
End Forall
End Sub
eknori
-
Danke für die Antwort...
Leider befindet sich das Attachment nicht in einem Richtext-Feld, sondern ist an das doc angehängt.
Mit dieser Methode komme ich also nicht weiter.
Als Anmerkung sollte ich vielleicht noch erwähnen, das es sich um einen WebQuerySave-Agenten handelt.
Dieser soll aus einem soeben im Web erzeugten doc ein bestimmtes Attachment in ein bestimmtes anderes doc kopieren.
Ist das überhaupt möglich ???
Die einzige Methode ein Attachment in einem doc zu erzeugen die ich gefunden habe braucht eine Pfadangabe zur Datei (embedObject von rtf-item). Da der Agent aber auf dem Server läuft nutzt mir das gar nichts. Zumal ich das Source-doc aus dem Web nicht speichern will...
Für jeden Tipp wäre ich echt dankbar...
CU
-
Bin nicht der Web Spezie daher hier unkommentiert ein Tip
Response to: Move Web Attachments to RTF
Author: Category: Release:
Janya Jackson
on 03/14/2000 at 05:42 PM Domino Designer -- LotusScript Release 5
Subject: RE:
--------------------------------------------------------------------------------
Message Content:
This code that I got from M. Shane Sturgeon off this web site worked!!
Dim session As New NotesSession
Dim doc As NotesDocument
Dim fileNames List As String
Set doc = session.DocumentContext
Set rtitem = New NotesRichTextItem(doc,"Attachments")
datadir$ = "E:"
' Detach All files
Set FileList = doc.GetFirstItem("$File")
While Not FileList Is Nothing
Call doc.GetAttachment(FileList.values(0)).ExtractFile(datadir$ &"\"& FileList.values(0))
fileNames(FileList.values(0)) = 1
Call FileList.Remove
Set FileList = doc.GetFirstItem("$File")
Wend
' Reattach to RTF Field
Forall fn In fileNames
fileName$ = Listtag(fn)
FilePath$ = datadir$ & "\" & fileName$
Call rtitem.embedObject(EMBED_ATTACHMENT,"",FilePath$,"")
Kill FilePath$
End Forall
-
Habe eine andere Möglichkeit gefunden.
Trotzdem Danke!