Domino 9 und frühere Versionen > ND6: Entwicklung
Bilder aus Notes DB exportieren
Gerhard:
Das Feld heisst Bild_A4, hier ist tatsächlich das Bild als jpg reingehängt, bei den Feldeigenschaften steht aber
Feldname: Bild_A4
Datentyp: Rich Text
Datenlänge: 2632 Byte
Seq.-Num.: 3
Doppeleintrags-ID: 0
Feld-Flags:
Und mich wundert warum hier nicht steht wie gross das Attachment ist, dies steht nur im Feld $FILE.
klaussal:
Also nimmst Du das Feld "Bild_A4" für das Script.
Und die Abfrage mit der FileSize ist wohl überflüssig.
Gerhard:
Die Filesize hab ich schon rausgetan, beim Feld hab ich Bild_A4 reingeschrieben, das Script sieht nun so aus und funktioniert noch immer nicht....
Sub Initialize
Dim doc As NotesDocument
Dim rtitem As Variant
Dim fileCount As Integer
fileCount = 0
'...set value of doc...
Set rtitem = doc.GetFirstItem( "Bild_A4" )
If ( rtitem.Type = RICHTEXT ) Then
Forall o In rtitem.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) Then
fileCount = fileCount + 1
Call o.ExtractFile _
( "c:\reports\newfile" & Cstr(fileCount) )
Call doc.Save( True, True )
End If
End Forall
End If
End Sub
Driri:
Wenn das das komplette Script ist, kann das so auch nicht funktionieren, denn doc ist gar nicht definiert. Da fehlt noch eine Schleife, um durch alle Dokumente zu laufen.
Das würde dann so aussehen, wobei da noch einiges an Errorhandling verbessert werden könnte :
--- Code: ---Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim rtitem As Variant
Dim fileCount As Integer
fileCount = 0
Set db = session.CurrentDatabase
Set dc = db.AllDocuments
If dc.Count > 0 Then
Set doc = dc.GetFirstDocument
While Not (doc Is Nothing)
Set rtitem = doc.GetFirstItem( "Bild_A4" )
If ( rtitem.Type = RICHTEXT ) Then
ForAll o In rtitem.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) Then
fileCount = fileCount + 1
Call o.ExtractFile _
( "c:\reports\newfile" & CStr(fileCount) )
Call doc.Save( True, True )
End If
End ForAll
End If
Set doc = dc.GetNextDocument(doc)
Wend
End If
End Sub
--- Ende Code ---
Edit : Achso, das Call doc.Save würde ich persönlich auch weglassen. Du brauchst die Dokumente nach zu speichern, nur weil das Attachment auf die Platte gelöst wird.
klaussal:
--- Zitat ---das Script sieht nun so aus und funktioniert noch immer nicht....
--- Ende Zitat ---
Diese Aussage ist ja nicht gerade hilfreich....
Navigation
[0] Themen-Index
[#] Nächste Seite
[*] Vorherige Sete
Zur normalen Ansicht wechseln