This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Sep 20, 2011, 11:36 AM
66 Posts

Problem with body field data type in email - richtext versus mime type ...

  • Category: Other
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags:
  • Replies: 3
In xPages app, I have to manipulate with mail message using the Java code.  For certain mail messages I cant access the body field as richtext. I'm using standard
 
 RichTextItem rt = (RichTextItem) doc.getFirstItem("body"); 
 
For certain internet messages I'm getting error:   java.lang.ClassCastException: lotus.domino.local.Item incompatible with lotus.domino.RichTextItem
It's because the body field (I can see it in document properties)  is type mime: 'Data Type: MIME Part' and not richtext . How can I handle this? I need to access field as RichText because I need to append this body field at the and of another rich text item using "appendRTItem" method.
 
Anyone any idea? Please ... 
 
Sep 20, 2011, 1:29 PM
6 Posts
Re: Problem with body field data type in email - richtext versus mime type ...
have a read of the domino help on MimeEntity Class, I think the getContentAsText method is what you are looking for.
Sep 20, 2011, 1:46 PM
66 Posts
Re: Problem with body field data type in email - richtext versus mime type ...
 Thank you, I tried this already, but this method return only following general text: "This is a multi-part message in MIME format" ... but not the content itself.
Sep 20, 2011, 4:17 PM
6 Posts
Re: Problem with body field data type in email - richtext versus mime type ...
Ok I have never done this before, however what I do know is: getContextAsText is only good with MIMEEntity when that Mime Entity header content-type and content subtype (use getContentType() and getContentSubType() ) is either "text/plain " or "text/html". Of course if it is text/html, getContextAsText will return all the content with the html tags... Note that MimeEntity could be a child MimeEntity to the MimeEntity you first get from the doc.getMimeEntity() If the top MimeEntity Content Type is not "multipart" then you could just use getContextAsText on the top MimeEntity to get all the content, then write that text to your other Body Item. Do let us know if this somehow worked.

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal