Domino 9 und frühere Versionen > ND6: Entwicklung
Name und Größe in ein Feld schreiben
(1/1)
mariab:
Möchte gerne den Filenamen und die Filegröße eines oder mehrerer Anhänge in ein Feld (D_Info) schreiben. Habe es mit
--- Code: ---doc.D_Info = sizes & namen
--- Ende Code ---
probiert, leider ist dies aber nicht zulässig. Auch weiss ich nicht, ob es mit zwei Forall-Schleifen eine elegante Lösung ist.
Danke für Eure Hilfe
--- Code: ---Sub Click(Source As Button)
Dim s As New NotesSession
Dim db As NotesDatabase
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim rt As NotesRichTextItem
Dim item As NotesItem
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Set rt = doc.GetFirstItem( "D_Doku" )
If rt Is Nothing Then
Msgbox "Kein Dateianhang vorhanden"
Exit Sub
End If
idx = 0
Forall o In rt.EmbeddedObjects
Redim Preserve sizes(idx)
sizes(idx) = o.Filesize
idx = idx + 1
End Forall
Forall n In rt.EmbeddedObjects
Redim Preserve namen(idy)
namen(idy) = n.name
idy = idy + 1
End Forall
doc.D_Info = sizes
End Sub
--- Ende Code ---
Axel:
Mal auf die Schnelle:
Sub Click(Source As Button)
Dim s As New NotesSession
Dim db As NotesDatabase
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim rt As NotesRichTextItem
Dim item As NotesItem
Dim strDateiInfo() As String
Dim idx As Integer
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Set rt = doc.GetFirstItem( "D_Doku" )
If rt Is Nothing Then
Msgbox "Kein Dateianhang vorhanden"
Exit Sub
End If
idx = 0
Forall o In rt.EmbeddedObjects
Redim Preserve strDateiInfo(idx)
strDateiInfo(idx) = o.Name & " " & Trim$(Str(o.Filesize))
idx = idx + 1
End Forall
doc.D_Info = strDateiInfo
End Sub
Das Feld D_Info muss vom Typ Text sein.
Ist allerdings ungetestet und hat mit Sicherheit noch Potential zur Optimierung.
Axel
mariab:
Danke.
Habe mir schon eine Stunde den Kopf zerbrochen.
Gut dass es dieses Forum gibt und Leute wie Axel, die immer bereit sind einen zu helfen
Navigation
[0] Themen-Index
Zur normalen Ansicht wechseln