jdembare
asked on
images in mime format message
How can I read the content-id of an image in a body message that is in mime format?
I can get the child/content type and sub-type i.e image/gif for instance plus the actual image content. I however need the CONTENT-ID for referencing purposes in displaying my final output.
Is there a method in the MIMEEntity class or anywhere else like getContentAsText() or getContentType() etc that can be used but to get the content-id instead?
Thx
I can get the child/content type and sub-type i.e image/gif for instance plus the actual image content. I however need the CONTENT-ID for referencing purposes in displaying my final output.
Is there a method in the MIMEEntity class or anywhere else like getContentAsText() or getContentType() etc that can be used but to get the content-id instead?
Thx
ASKER
Thanks Scott worked fine however I realized that I left the setting part as well. I can't seem to then set the content-ID value of the new document I am creating. I tried setContentFromText(stream. ..) function but obviously this it is not recognised as a header setting.Part of my code is:
Stream stream = session.createStream();
MIMEEntity body = doc.createMIMEEEntity();
MIMEHeader header = body.createHeader("Content -Type");
header.setHeaderVal("multi part/mixed ");
....
MIMEEntity child = body.createChildEntity();
stream.writeText(THE CONTENT-ID VALUE);
child.setContentFromText(s tream,"ima ge/gif",MI MEEntity.E NC_BASE64) ;
Obviously this isn't setting the header values coz when I read the headers of the new document it's returning:
Content-Transfer-Encoding: base64
Content-Type: image/gif
So I am still missing the content-id value in the header. How can i set this value maybe with something like setHeaderVal or what?
Thanks so much for the 1st pointer Scott.
jay
Stream stream = session.createStream();
MIMEEntity body = doc.createMIMEEEntity();
MIMEHeader header = body.createHeader("Content
header.setHeaderVal("multi
....
MIMEEntity child = body.createChildEntity();
stream.writeText(THE CONTENT-ID VALUE);
child.setContentFromText(s
Obviously this isn't setting the header values coz when I read the headers of the new document it's returning:
Content-Transfer-Encoding:
Content-Type: image/gif
So I am still missing the content-id value in the header. How can i set this value maybe with something like setHeaderVal or what?
Thanks so much for the 1st pointer Scott.
jay
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I see ur point but it's getting a bit hectic. stream is just a way of passing any content to the entities I suppose nothing much to it. the real question is can I set the child entity's header value - Content-ID? As u can see that the funciton setContentFromText(...) does set the Content-Type (2nd parameter); and encoding (3rd parameter); All I need is to then set as well the Content-ID.
Will see if I can fit the socket idea in my situation.
NB: code above in java but nothing different or unique to lotuscript.
regards,
jay
Will see if I can fit the socket idea in my situation.
NB: code above in java but nothing different or unique to lotuscript.
regards,
jay
(Declarations)
Dim HeadersTextStr As String
Dim BodyTextStr As String
Sub Concatenate
Dim mime As NotesMIMEEntity
Dim mime2 As NotesMIMEEntity
s.ConvertMime = False
HeadersTextStr = ""
BodyTextStr = ""
Set item = doc.GetFirstItem("Body")
If Not (item.Type = MIME_PART) Then
Exit Sub
End If
Set mime = item.GetMimeEntity
While Not (mime Is Nothing)
If Lcase$(mime.ContentType) = "text" Then
HeadersTextStr = HeadersTextStr & mime.Headers
BodyTextStr = BodyTextStr & mime.ContentAsText
End If
Set mime2 = mime.GetFirstChildEntity
If mime2 Is Nothing Then
Set mime2 = mime.GetNextSibling
End If
If mime2 Is Nothing Then
Set mime2 = mime.GetParentEntity
If Not (mime2 Is Nothing) Then
Set mime2 = mime2.GetNextSibling
End If
End If
Set mime = mime2
Wend
End Sub
I can then search the HeadersTextStr and BodyTextStr for whatever substrings I want:
Sub CheckMimeBody
If Instr(1,BodyTextStr,"conte
'Do some processing here
End If
End Sub
Hope this helps.
Scott