Willkommen
Gast
. Bitte
einloggen
oder
registrieren
.
22.05.12 - 13:00:59
News:
Schnellsuche:
Das Notes Forum
Lotus Notes / Domino 6
ND6: Entwicklung
(Moderatoren:
_Arne_
,
Axel
,
eknori
,
ata
,
koehlerbv
)
$File Attachments von einem Dokument in ein anderes kopieren
« vorheriges
nächstes »
Seiten:
[
1
]
Autor
Thema: $File Attachments von einem Dokument in ein anderes kopieren (Gelesen 2203 mal)
datenbanken24
Senior Mitglied
Offline
Geschlecht:
Beiträge: 371
Stammgast
$File Attachments von einem Dokument in ein anderes kopieren
«
am:
30.08.04 - 19:21:55 »
Es MUSS doch irgendwie eine Möglichkeit geben, Dateianhänge, die im Web erstellt wurden,
also $FILE (s) ohne Richtextfeld (!)
einfach von einem Notes-Dokument in ein anderes zu kopieren,
z.B. in eine automatisch zu generierende Mail im WebQuerySaveAgent...
Die "Suchfunktion" im Forum habe ich schon glühen lassen, genauso im Domino-Forum.
Ist das wirklich in R6 immer noch unmöglich ?
1.)
Kopieren über
call maildoc.ReplaceItemValue("$FILE", doc.GetItemValue("$FILE"))
ok - das wäre zu einfach für Domino - schade auch
2.)
Richtext-Feld kopieren geht nicht, weils im Quelldokument kein Richtext Feld gibt
3.
Items vom Type "ATTACHMENT" zu kopieren über copyitem - geht natürlich auch nicht...
"Can't copy items of type ATTACHMENT or OTHEROBJECT"
4.
Ein RichtextItem Item im Zieldokument zu generieren und alle Items mit dem Namen $File zu "appenden" geht auch nicht (type mismatch)
4.)
Man kann natürlich die Anhänge vom Quelldokument als Embedded objects erst aus dem Dokument auf die Platte extrahieren und dann wieder über rtitem.Embedobject in das neue Dokument zerren - oh Graus - das ist doch auf einem Server wirklich der allerletzte Weg, den man gehen sollte. Da sträubt sich doch alles.
Das dauert nicht mal 48 Stunden und man hat die ersten "Hackerdateien" auf dem Server und man weiss nie, ob der "Müll" dann auch wieder richtig entfernt wird. Es ist doch gerade ein echtes Domino Feature, die Dateianhänge in relativ sicheren Notes Documenten zu haben und eben nicht auf der Platte.
Sage mir bitte jemand, dass ich eine Möglichkeit übersehen habe
und es dafür eine Lösung gibt.
Danke,
Uwe
«
Letzte Änderung: 30.08.04 - 19:25:18 von datenbanken24
»
Gespeichert
www.datenbanken24.de
+++
www.dominowebbase.de
+++
www.manetec.de
datenbanken24 gewinnt auf der CeBIT 2005 den Innovations-Preis "Modern Business Award"
koehlerbv
Moderator
Gold Platin u.s.w. member:)
Online
Geschlecht:
Beiträge: 19044
Re:$File Attachments von einem Dokument in ein anderes kopieren
«
Antworten #1 am:
30.08.04 - 19:26:28 »
Hast Du schon der NotesDocument.CopyItem method eine Chance gegeben ?
Bernhard
Gespeichert
datenbanken24
Senior Mitglied
Offline
Geschlecht:
Beiträge: 371
Stammgast
Re:$File Attachments von einem Dokument in ein anderes kopieren
«
Antworten #2 am:
31.08.04 - 02:13:41 »
Leider nein...
"Can't copy items of type ATTACHMENT or OTHEROBJECT"
...aber:
Die NOT(es)-Lösung (die wir nun gefunden haben) heißt wie so oft:
"Treffer - von hinten durch die Brust ins Auge !"
Obwohl "doc.CopyItem" keinerlei Attachments kopieren kann,
kann es "doc.CopyAllItems" problemlos. (LO-gisch NO-tes...)
Also kopiert man fleissig erst mal alle Items in das neue Dokument,
um dann alle Nicht-$Files wieder zu removen:
Call doc.CopyAllItems( maildoc , True )
Forall item In maildoc.Items
If Not item.Name = "$FILE" Then
Call item.Remove
End If
End Forall
Zurück bleibt ein neues leeres Dokument mit den Attachments.
Danach fängt man an, seine Felder zu setzen und versendet das Dokument als Mail.
So behält auch der Werbeslogan von Notes:
"PROGRAMMIEREN DURCH KOPIEREN"
immer wieder auf's neue recht.
Für eine sauberere Lösung wäre ich aber immer noch sehr dankbar,
denn die nächste Frage wäre, was ist, wenn man nicht alle Attachments kopieren möchte...
Gespeichert
www.datenbanken24.de
+++
www.dominowebbase.de
+++
www.manetec.de
datenbanken24 gewinnt auf der CeBIT 2005 den Innovations-Preis "Modern Business Award"
Tode
Gold Platin u.s.w. member:)
Offline
Geschlecht:
Beiträge: 2794
Geht nicht, gibt's (fast) nicht... *g*
Re:$File Attachments von einem Dokument in ein anderes kopieren
«
Antworten #3 am:
31.08.04 - 08:02:40 »
Tja... wenn man ein wenig in der Knowledgebase suchen würde, dann käme man ruckzuck zum Ergebnis... Schade, dass es immer wieder Programmierer gibt, die Ihre wichtigsten Quellen nicht kennen...
Artikel aus der KB (1104835):
Problem
Some attachments display at the bottom of a document rather than within a Rich Text field. This type of attachment is attached to the document itself and is called a V2-style attachment (because Notes release 2.x could attach files only in this manner). These types of attachments are also created when you attach a file from a Web browser, using a file upload control.
How can you convert a V2-style attachment to an attachment that appears within a Rich Text field?
Solution
This conversion is possible using Notes 4.5.2 and later releases.
The NotesDocument class has an array of NotesItems within its Items property. The Items property itself refers to an array of NotesItems, and the elements within this array have a Values property. It is this Values property that contains the name of the attachment, allowing you to extract the file to disk and then embed the file within a Rich Text field.
The example below demonstrates one method of using these properties and methods to extract an embedded file and then embed it within a Rich Text field. In this example, the Rich Text field name is "RTF". The code sample below does not perform any deletion of the files it writes to disk.
Code Sample:
Sub Initialize
Dim doc As NotesDocument
Dim item As Variant
Dim nitem As Variant
Dim rtitem As Variant
Dim uidoc As notesuidocument
Dim w As New notesuiworkspace
Set uidoc=w.currentdocument
Set doc = uidoc.document
Forall i In doc.Items
If i.type = Attachment Then
Set emb = doc.GetAttachment(i.values(0))
Set rtitem=doc.getfirstitem("RTF")
Call emb.extractfile("C:\" & emb.name)
Call rtitem.embedobject(EMBED_Attachment, "", "C:\" & emb.name, emb.name)
Kill "C:\" & emb.name
Call emb.remove
Call doc.save(1,1)
' If one is only searching for one attachment then remove the remark from the line below
' Exit Forall
End If
End Forall
End Sub
In order to perform these type of file manipulations in background agents, the signer of the agent must be included in the "Run Unrestricted Lotus Script agents" in the Agent Manager section of the Server document in the Name and Address Book.
Related Documents:
Files Attached Using EmbedObject Method Appear as V2 Style Attachments
Document #: 1089682
File Upload Control Places an Attachment in Each Rich Text Field When Using Java Applet
Document #: 1099645
P.S.: Ich habe den folgenden Code mal verwendet, um ein Per File-Upload-Control hinzugefügtes Attachment per WebQuerySaveAgent ins Body- Feld zu kopieren:
Dim ses As New NotesSession
Dim doc As NotesDocument
Dim v2File As NotesItem
Dim rtItem As NotesRichTextItem
Dim inputAttachment As NotesEmbeddedObject
Dim tempDirectory As String
Dim fileName As String
Dim filePath As String
Dim moveToFieldName As String
moveToFieldName = "Rt_Dokument_Anhänge"
Set doc = ses.DocumentContext
Set v2File = doc.GetFirstItem ( "$File" )
fileName = v2File.Values(0)
Set inputAttachment = doc.GetAttachment ( fileName )
tempDirectory = ses.GetEnvironmentString ( "Directory", True )
filePath = tempDirectory + "\" + fileName
'--Save the file on the server
Call inputAttachment.ExtractFile ( filePath )
'--Delete the original attachment
Call doc.RemoveItem ( "$File" )
'--Create the rich text item and re-attach the file
If doc.HasItem ( moveToFieldName ) Then
Set rtItem = doc.GetFirstItem ( moveToFieldName )
Else
Set rtItem = New NotesRichTextItem ( doc, moveToFieldName )
End If
Set inputAttachment = rtItem.EmbedObject ( EMBED_ATTACHMENT, "", FilePath )
'--Finally, delete the file from the server file system
Kill FilePath
«
Letzte Änderung: 31.08.04 - 08:07:31 von Tode
»
Gespeichert
Gruss
Torsten (Tode)
P.S.: Da mein Nickname immer mal wieder für Verwirrung sorgt: Tode hat NICHTS mit Tod zu tun. So klingt es einfach, wenn ein 2- Jähriger versucht "Torsten" zu sagen...
Alles beim alten zu lassen kostet nichts.....
.....nichts als die Zukunft !
pers. Infos:
seit 1995 in der Notes/Domino Administration und Programmierung, Senior Consultant (hört sich so schön hochtrabend an) zu allem möglichen rund um Notes/Domino (Blackberry, Traveler, Sametime, Quickr, ein bisschen Lotus Connections...)
eknori
@Notes Preisträger
Moderator
Gold Platin u.s.w. member:)
Online
Geschlecht:
Beiträge: 10102
No guts, No glory!!
Re:$File Attachments von einem Dokument in ein anderes kopieren
«
Antworten #4 am:
31.08.04 - 08:06:51 »
dann wird das Zeugs aber doch erst auf die Platte geschrieben ... und das soll doch umgangen werden
Gespeichert
Gruß Ulrich (eknori) Krause
"Reich wird man nicht durch das, was man verdient, sondern durch das, was man spart"
pulmonale Hypertonie e.V.
Tode
Gold Platin u.s.w. member:)
Offline
Geschlecht:
Beiträge: 2794
Geht nicht, gibt's (fast) nicht... *g*
Re:$File Attachments von einem Dokument in ein anderes kopieren
«
Antworten #5 am:
31.08.04 - 08:11:25 »
so ist das leider... Auszug aus dem Artikel 1104834:
...
' There is no other way to perform this operation without the code writing the file to disk
' and then re-embedding it from the file on disk.
...
Tode
Gespeichert
Gruss
Torsten (Tode)
P.S.: Da mein Nickname immer mal wieder für Verwirrung sorgt: Tode hat NICHTS mit Tod zu tun. So klingt es einfach, wenn ein 2- Jähriger versucht "Torsten" zu sagen...
Alles beim alten zu lassen kostet nichts.....
.....nichts als die Zukunft !
pers. Infos:
seit 1995 in der Notes/Domino Administration und Programmierung, Senior Consultant (hört sich so schön hochtrabend an) zu allem möglichen rund um Notes/Domino (Blackberry, Traveler, Sametime, Quickr, ein bisschen Lotus Connections...)
datenbanken24
Senior Mitglied
Offline
Geschlecht:
Beiträge: 371
Stammgast
Re:$File Attachments von einem Dokument in ein anderes kopieren
«
Antworten #6 am:
31.08.04 - 08:28:31 »
Danke für den Code - aber das Schreiben auf Disk kommt, wie oben angemerkt, für uns aus mehreren Gründen nicht in Frage:
- Standardsoftware Installation auf Kundenrechnern (verzeichnisstruktur unbekannt)
- OS unbekannt, case else für win, mac, linux usw nötig.
- Unrestricted agents müssen für den Aunterzeichner zugelassen sein (Aufwand)
- Beste Einladung für Trojaner, Viren oder Rootkits
- Schreibst und löschst Du auf diese Weise in Linux, bleibt immer eine automatische Sicherungs-/Logdatei hängen
- usw.
Für Kunden-Einzelprojekte sieht das natürlich nicht so schlimm aus.
Deshalb werden wir den Code mit dem CopyAllItems erst einmal vorziehen
Gespeichert
www.datenbanken24.de
+++
www.dominowebbase.de
+++
www.manetec.de
datenbanken24 gewinnt auf der CeBIT 2005 den Innovations-Preis "Modern Business Award"
Seiten:
[
1
]
« vorheriges
nächstes »
Gehe zu:
Bitte wählen Sie ein Ziel:
-----------------------------
ATNOTES TEAM
-----------------------------
=> Neuigkeiten - Wichtiges
===> Archiv
-----------------------------
Lotus Notes / Domino 8
-----------------------------
=> ND8: Administration & Userprobleme
=> ND8: Entwicklung
=> ND8: Entwicklung - XPages
-----------------------------
Lotus Notes / Domino 7
-----------------------------
=> ND7: Administration & Userprobleme
=> ND7: Entwicklung
-----------------------------
Lotus Notes / Domino 6
-----------------------------
=> ND6: Administration & Userprobleme
=> ND6: Entwicklung
-----------------------------
Domino 5 und frühere Versionen
-----------------------------
=> Administration & Userprobleme
=> Entwicklung
-----------------------------
Lotus Notes / Domino Sonstiges
-----------------------------
=> Tipps und Tricks
=> Tools & Downloads
=> Projekt Bereich
===> Help-Desk Applikation !!Help!!
=> Java und .NET mit Notes/Domino
=> Companion Products
=> OLE/COM-Programmierung
=> Aus- und Weiterbildung
-----------------------------
Best Practices
-----------------------------
=> At Notes Best Practices
=> Diskussionen zu Best Practices
-----------------------------
Sonstiges
-----------------------------
=> Offtopic
=> Kritik & Vorschläge
=> Infrastruktur
=> Job Suche/Angebote
1 Stunde
1 Tag
1 Woche
1 Monat
Immer
Einloggen mit Benutzername, Passwort und Sitzungslänge
Powered by SMF 1.1.16
|
SMF © 2006, Simple Machines
Impressum Atnotes.de -
Powered by Syslords Solutions -
Datenschutz
| Partner:
Tinte / Toner günstig