Domino 9 und frühere Versionen > ND6: Entwicklung

Mime Type eines Attachments erkennen

(1/2) > >>

y20frank:
Hallo zusammen,

gibt es die Möglichkeit, das mime-type eines Attachments aus einem Notes-Dokument auszulesen?

Also, in einer Datenbank (R6.5'er'er Clients) ist ein RTF 'Body', dort ist immer nur ein Datei-Anhang drin. Dieser kann von unterschiedlichem Typ sein (z. B. wie application/msexcel   *.xls *.xla Microsoft Excel Dateien, image/gif *.gif GIF-Dateien, application/msword *.doc *.dot Microsoft Word Dateien ... usw)

Gibt es nun - per Script oder Formel - die Möglichkeit, an diese Informationen des Anhanges heranzukommen?

Danke und Gruß
Frank


flaite:
Schau dir mal die Klasse NotesMimeEntity in der Hilfe an.
Das könnte helfen

y20frank:
Danke dir, habe das auch schon gefunden, komme damit (siehe Script aus der Hilfe nachstehend) aber nicht weiter. Brauche den mime-type des Attachments.


--- Code: ---Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim mime As NotesMIMEEntity
Dim m As String
Set db = s.CurrentDatabase
s.ConvertMIME = False ' Do not convert MIME to rich text
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
While Not(doc Is Nothing)
Set mime = doc.GetMIMEEntity
If Not(mime Is Nothing) Then     
Messagebox mime.ContentAsText,, _
doc.GetItemValue("Sunject")(0)
Else
Messagebox "Not MIME",, _
doc.GetItemValue("Subject")(0)
End If
Set doc = dc.GetNextDocument(doc)
Wend
s.ConvertMIME = True ' Restore conversion
End Sub

--- Ende Code ---

flaite:
Ich müßte in der Firma noch code haben, wo ich durch alle in einer Email benutzten Mimes iteriere. Viellicht hilft das irgendwie weiter. Schau morgen mal nach.

gruß Axel

flaite:
weiss nicht obs hilft:
Das in Initialize eines Agenten in der Mail-db.

-> Auswahl im Menü Aktionen
-> Ziel: Alle ausgewählten Dokumente
Dokumente anhaken und dann Agenten per Menü starten.
Vielleicht kannst du das irgendwie nutzen. 


--- Code: ---Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim mime As NotesMIMEEntity
Dim child As NotesMIMEEntity
Dim m As String
Set db = s.CurrentDatabase
s.ConvertMIME = False
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
Dim countChild As Integer
While Not(doc Is Nothing)
Msgbox "startMail mail->" & doc.subject(0)
Set mime = doc.GetMIMEEntity
If Not(mime Is Nothing) Then
If mime.ContentType = "multipart" Then
If mime.Preamble = "" Then
p$ = "No preamble"
Else
p$ = mime.Preamble
End If
Messagebox p$,, "preamble of:" & doc.GetItemValue("Subject")(0)
Set child = mime.GetFirstChildEntity
countChild = 0
While Not(child Is Nothing)
countChild = countChild + 1

m = "Content type:" & Chr(9) & _
child.ContentType & Chr(13) & _
"Content subtype:" & Chr(9) & _
child.ContentSubType & Chr(13) & _
"Character set:" & Chr(9) & _
child.Charset & Chr(13) & _
"Encoding:" & Chr(9) & Chr(9) & _
child.Encoding
Messagebox m,, "child: (" & Cstr(countChild) & " in Mail->" & doc.subject(0)
Messagebox child.Headers,, "Headers von child: (" & Cstr(countChild) & " in Mail->" & doc.subject(0)

Messagebox child.ContentAsText,, "child: (" & Cstr(countChild) & " in Mail->" & doc.subject(0)

Set child = child.GetNextSibling
Wend
Else ' if not multipart


m = "Content type:" & Chr(9) & _
mime.ContentType & Chr(13) & _
"Content subtype:" & Chr(9) & _
mime.ContentSubType & Chr(13) & _
"Character set:" & Chr(9) & _
mime.Charset & Chr(13) & _
"Encoding:" & Chr(9) & Chr(9) & _
mime.Encoding
Messagebox m,, "main of mail:" & doc.GetItemValue("Subject")(0)
Messagebox mime.Headers,, "Headers of main of mail:" & doc.GetItemValue("Subject")(0)

Messagebox mime.ContentAsText,, _
"main of mail:" & doc.GetItemValue("Subject")(0)
End If
Else ' if not MIME
Messagebox "Not MIME",, _
doc.GetItemValue("Subject")(0)
End If
Msgbox "END mail->" & doc.subject(0)
Set doc = dc.GetNextDocument(doc)
Wend
s.ConvertMIME = True ' Restore conversion
End Sub

--- Ende Code ---

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln