Method Message.setContent fails

Hello

(BB 4.2.2 Simulator (8310 device) and BBJDE 4.2.1.41)

I want to clone a message cleared to move this new message in a custom folder,
but when I put the content for the new message the application throws this error:
"MailAPI: cannot set content specified parameter.

I do this:
/* *********************** */
public static net.rim.blackberry.api.mail.Message cloneMessage (source net.rim.blackberry.api.mail.Message) {}
try {}
net.rim.blackberry.api.mail.Message clone = new Message();
clone.setFlags (source.getFlags ());
System.out.println (source. GetContentType());  is text/plain
Object lMsgContent = source.getContent ();
If (lMsgContent! = null)
clone.setContent (lMsgContent);  SURVEY ERROR HERE
     
If (source.getFrom ()! = null) clone.setFrom (source.getFrom ());
clone.setInbound (source.isInbound ());
clone.setPriority (source.getPriority ());
Cloning of the headers does not seem to work. He throws exceptions
If (source.getReplyTo ()! = null) clone.setReplyTo (source.getReplyTo ());
If (source.getSentDate ()! = null) clone.setSentDate (source.getSentDate ());
clone.setStatus (source.getStatus (), 0);
If (source.getSubject ()! = null) clone.setSubject (source.getSubject ());
   
cloneRecipients (source, clone, Message.RecipientType.TO);
cloneRecipients (source, clone, Message.RecipientType.CC);
cloneRecipients (source, clone, Message.RecipientType.BCC);
           
return clone;
} catch (Exception err) {}
System.out.println (Err.ToString () + ":"+ err.getMessage () ');
Returns a null value.
}
}
/* *********************** */

what I'm missing here?

Thank you!
Mauricio.

Mauricio,

You seem to meet a multipart message. What you can do is to check if your content is a TextBodyPart:

String msgTxt = null;

if( lMsgContent instanceof TextBodyPart ) {
    msgTxt = ((TextBodyPart) lMsgContent).getContent();
}

Then, from there, you can set your content:

if (msgTxt != null)   clone.setContent(msgTxt);

This may not work in new versions of the OS since getContent() may return null if the Message has a part of the Multipart (HTML and plain text) body.

Tags: BlackBerry Developers

Similar Questions

  • The message send failed.

    When sending an email, I get the following:

    The message send failed.
    The server of SMTP smtp - server.cfl.rr.com does not support encrypted passwords. If you create the account, please try to replace "Password, transmitted from unsecured way" as the "authentication method" in the "account settings |" The server settings. If it used to work and now suddenly fails, it is a common scenario how someone could steal your password.

    Not many suppliers use encrypted passwords. Since this is for sending you changed normal password under the SMTP server settings?

    Tools-account-outgoing server (SMTP) settings

  • I get the error message: maigration failed to transfer when I install Windows updates. How can I fix

    I get the error message: maigration failed to transfer when I install Windows updates. How can I fix

    Hello

    Thanks for asking!

    You cannot install updates Windows and error migration was not able to transfer.

    The problem can occur if the update of the components are damaged.

    Is the message of exact error that appears?

    I suggest you to reset the update components and check if the problem persists.

    See the site:

    How to reset the Windows Update components?

    http://support.Microsoft.com/kb/971058

    Warning: this section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click on the number below to view the article in the Microsoft Knowledge Base:

    How to back up and restore the registry in Windows XP

    http://support.Microsoft.com/kb/322756/

  • Others become the iTunes update server message connection failed?

    Others become the iTunes update server message connection failed?

    My iPad has the logo of iTunes with the load icon and cannot update or restore on computer at home.

    All internet connections are very good.

    I'm having the same problem I tried 3 cables of computers 4 and my ipad won't restore or update.

  • The message send failed - Please verify your account settings are correct.

    I got Thunderbird established and working for years with multiple accounts. All of a sudden today, I can't send all messages in ANY of my accounts with several Web hosts. The message I get from all of them is:

    The message send failed.
    Check that your Mail & Newsgroups account settings are correct and try again.

    I checked my settings. The look that is configured in the same way they always do. I can send email with these parameters from my phone (K9 Mail on Android program.)

    All my accounts that can receive messages in Thunderbird. I get new messages and I can read them.

    If I try to save a message as a project over IMAP, I get the error:

    Unable to save your message as a draft.
    Check that your Mail & Newsgroups account settings are correct and try again.

    What could possibly change to make Thunderbird exhibit this behavior? I tried without thunderbird downgrade to the previous version and it still had the same behavior. I tried to start in safe mode without the extensions, and he had always the same behavior. Here are my troubleshooting information:

     Application Basics
    
       Name: Thunderbird
       Version: 31.7.0
       User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
       Profile Directory: Open Directory
    
                 (Local drive)
       Application Build ID: 20150511105107
       Enabled Plugins: about:plugins
       Build Configuration: about:buildconfig
       Memory Use: about:memory
    
     Mail and News Accounts
       account1:
         INCOMING: account1, , (imap) sub4.mail.dreamhost.com:993, SSL, passwordCleartext
         OUTGOING: sub4.mail.dreamhost.com:465, SSL, passwordCleartext, true
         OUTGOING: sub4.mail.dreamhost.com:465, SSL, passwordCleartext, false
         OUTGOING: sub4.mail.dreamhost.com:465, SSL, passwordCleartext, false
         OUTGOING: sub4.mail.dreamhost.com:465, SSL, passwordCleartext, false
         OUTGOING: sub4.mail.dreamhost.com:465, SSL, passwordCleartext, false
         OUTGOING: sub4.mail.dreamhost.com:465, SSL, passwordCleartext, false
    
       account2:
         INCOMING: account2, , (none) Local Folders, plain, passwordCleartext
    
       account3:
         INCOMING: account3, , (imap) secure.emailsrvr.com:993, SSL, passwordCleartext
         OUTGOING: secure.emailsrvr.com:465, SSL, passwordCleartext, true
    
       account4:
         INCOMING: account4, , (imap) secure.emailsrvr.com:993, SSL, passwordCleartext
         OUTGOING: secure.emailsrvr.com:465, SSL, passwordCleartext, true
    
       account5:
         INCOMING: account5, , (imap) imap.googlemail.com:993, SSL, passwordCleartext
         OUTGOING: smtp.googlemail.com:465, SSL, passwordCleartext, true
    
       account6:
         INCOMING: account6, , (imap) imap.googlemail.com:993, SSL, passwordCleartext
         OUTGOING: smtp.googlemail.com:465, SSL, passwordCleartext, true
    
     Crash Reports
    
     Extensions
       Flat Folder Tree, 1.1.2, true, [email protected]
       Google Contacts, 0.7.12, true, {BDD92442-0534-4D6F-A966-BAB7D561D781}
       NoComposeAccount, 1.3.1, true, [email protected]
       Xpunge, 0.6, true, {786abda0-fd14-d247-bf69-38b2fc18491b}
       Enigmail, 1.7.2, false, {847b3a00-7ab1-11d4-8f02-006008948af5}
       Messaging Menu and Unity Launcher integration, 1.3.1, false, [email protected]
    
     Important Modified Preferences
    
       Name: Value
    
         accessibility.typeaheadfind.flashBar: 0
         browser.cache.disk.capacity: 358400
         browser.cache.disk.smart_size_cached_value: 358400
         browser.cache.disk.smart_size.first_run: false
         browser.cache.disk.smart_size.use_old_max: false
         extensions.lastAppVersion: 31.7.0
         mail.openMessageBehavior.version: 1
         mailnews.database.global.datastore.id: cbdcac30-9bd0-4a88-9a66-31a0abff554
         network.cookie.prefsMigrated: true
         places.database.lastMaintenance: 1435582206
         places.history.expiration.transient_current_max_pages: 104858
         plugin.importedState: true
    
     Graphics
    
         Adapter Description: X.Org -- Gallium 0.4 on AMD RV620
         Vendor ID: X.Org
         Device ID: Gallium 0.4 on AMD RV620
         Driver Version: 3.0 Mesa 10.5.2
         WebGL Renderer: false
         GPU Accelerated Windows: 0
    
         AzureCanvasBackend: cairo
         AzureSkiaAccelerated: 0
         AzureFallbackCanvasBackend: none
         AzureContentBackend: cairo
    
     JavaScript
    
     Incremental GC: 1
    
     Accessibility
    
       Activated: 0
       Prevent Accessibility: 0
    
     Library Versions
    
         Expected minimum version
         Version in use
    
         NSPR
         4.10.6
         4.10.6
    
         NSS
         3.16.2.3 Basic ECC
         3.16.2.3 Basic ECC
    
         NSS Util
         3.16.2.3
         3.16.2.3
    
         NSS SSL
         3.16.2.3 Basic ECC
         3.16.2.3 Basic ECC
    
         NSS S/MIME
         3.16.2.3 Basic ECC
         3.16.2.3 Basic ECC
    

    The problem was that my directory/tmp was not mounted. I don't know why it has not been mounted, but restarting the Assembly fixed.

    Thunderbird was IO error trying to create temporary files. The error messages were misleading, making me think it had to do with e-mail accounts.

  • I uninstalled Firefox on my computer, then I reinstalled and tried to run, but this message appeared, "failed to load your Firefox profile,"

    I uninstalled Firefox on my computer, then I reinstalled and tried to run, but this message appeared, "failed to load your Firefox profile. It may be missing or inaccessible"and Firefox does not open.

    I tried press windows key + R on my computer and open %appdata%\Mozilla\ - and rename the folder labeled "Firefox", but he said that "the action cannot be complete because the folder or the file that is open in another program" I didn't open it and try to restart the pc, but still no help

    A likely cause is a problem with the file profiles.ini and the profile marked as the default value = 1 in this file is no longer present on the hard drive.

    • Windows: %AppData%\Mozilla\Firefox\
      C:\Users\ < user > < profile > \AppData\Roaming\Mozilla\Firefox\Profiles\.
    • Linux: ~/.mozilla/firefox/
    • Mac: ~/Library/Application Support/Firefox /.

    You can use one of them to make the Creation/use of a new default profile for Firefox:

    • Remove the profiles.ini file to force Firefox to create a new default profile
    • Use the Profile Manager to create a new profile
    • Use "Choose a folder" when you create a new profile to select the location of a lost profile and recover this profile
  • I want to install the ios 9.3 update in my iPad. I get the message: "audit failed because you are no longer connected to the Internet" actually, my wifi works and I'm online. Help, please.

    I wanted to install an update to iOS 9.3 on my iPad mini legacy. After that I entered the password for my motto. I receive the message: "check failed because you are no longer connected to the Internet. I then checked my wifi and works and I can go online. why I can't update? Help, please. Thank you

    This is a known error for which Apple seeks a solution. See Troubleshooting iOS 9.3 update problems.

  • When I try to log the p2p soulseek site, I get the error message "connection failed: socket error.» change the connection settings. How can I fix it?

    "socket error".

    When I try to log the p2p soulseek site, I get the error message "connection failed: socket error.» change the connection settings. How can I fix it? Is - this type of error called a winsock error?  It keeps happening to me on this site. What I've read, it happens when you make changes to a program before concluding that under its weight. Could it happen because I'm deleting files, I don't think that will be completed while the other files are D/Ling? That's what I'm doing wrong? I found a solution to correct an error in Winsock that is to enter the "command prompt" and type "netsh winsock. Will this work? (I'm sorry I have so many questions in this post, but I have had TO KNOW!!)

    Hello

    I suggest you send the question here for best support about the issue.

  • I am trying to use Outlook Express to send pages and web sites to your friends but get messages that failed because my p.o. box address is wrong.

    Outlook Express conecting

    I am trying to use Outlook Express to send pages and web sites to your friends but get messages that failed because my p.o. box address is wrong. How will I know what is my mailing address? My other e-mail - but which I access via Mozilla - works fine, account, I cannot send web pages. As always, thank you for your help unfailing. G. R. Davis

    Setting up email in Outlook Express servers:
    http://www.Microsoft.com/Windows/IE/community/columns/mailserver.mspx 
    Who is your mail server?
  • I have a Dell Dimension 3000 CPU and I try to re - install a Dell 720 printer. I get the message. "Failed to start spooler log on the local computer. Error 1075: The dependency service is not...

    Original title: Journal of spooler

    I have a Dell Dimension 3000 CPU and I try to re - install a Dell 720 printer. I get the message. "Failed to start spooler log on the local computer. Error 1075: The dependency service does not exist or has been marked for deletion. I tried this diagnosticTo start print spooler service and also long-term arer services set it to automatic, follow these steps.     a. Click Start, right click on my computer and select manage.  b. in the console that opens, expand the menu Services and applications.  c. click Services.  d. click the button twice to spool print.  e. in the 'Général' tab, go to Startup Type.  f. the Automatic value.  g. click on the Start button.  h. click on apply and Ok.     Click the Dependencies tab, and not all the dependency services and repeat the steps above to set automatic and start the service.      Restart the computer after you start the services above. After restarting the computer check if you can install the printer. And a few others. Someone at - it suggestions? This printer has been operational on this computer at any given time. Windows XP Home / Firefox. .:

    Hello

    1. don't you make changes on the computer before this problem?
    2. when exactly you get this error message?

    Step 1: Run the fix it tool using the article below and check out them.

    Problems printing and printing errors
    http://support.Microsoft.com/mats/printing_problems/

    Step 2: Try the steps from the article below and check out them.

    Error message when you try to start the spooler service for printing on a Windows XP-based computer: "error 1075.
    http://support.Microsoft.com/kb/915168/en-GB

  • I can't start windows Vista, I get this message: Loadkey failed with error 1016

    Hello. I can't start windows Vista in all configurations. I get this message: Loadkey failed with error 1016 (sthive = 0).
    I get the same message when I try normal or safe modes. The mouse and keyboard do not work. I have
    don't know what to do next. Any suggestion would be appreciated. Victor

    Hello and thanks for your reply. The problem has been fixed. I'm not exactly sure how, but that's what happened. When I'm at a screen that says "repair windows" the cursor would not move to click on proceed. When I had almost gave up and was will wipe the hard drivbe and do a clean installation of "Windows 7", I turned on the computer and got to repair screen and the cursor was somehow operable. I clicked on continue and the computer fixed itself and has been running as good as new since. The computer is 'HP' office and running "Vista".
    Thank you and this problem is solved. Victor1244

  • Error message: MatsGetSapCatalogue failed when I try to log on to Fixit Center.

    Original title: MatsGetSapCatalogue failed

    Why do I receive the message > MatsGetSapCatalogue failed< when="" i="" try="" to="" log="" on="" to="" fixit="" center?="">

     

    Hi Malgaff,

    Since you get this message when you try to log on to Fixit Center, you can post your query on Microsoft Fix center for assistance.

    Microsoft Fix it Center

  • Windows 7 Home Premium... weekly back ups fail, get the message "backup failed."

    Recently my regular weekly back ups fail to find. Everything seems to go well until maybe halfway through the procedure when the backup stops & I get message "backup failed." Unfortunately, did not keep a note of relative error code... no useful guidance please.

    I'm glad to hear that you managed to solve your problem.

    Flash drives are a medium of reasonable storage but not the best. I recommend that get you a disk 2.5 "500 GB hard in a USB enclosure. They cost less than $60.00. Here's why:

    • They tend to be more reliable than flash drives.
    • They have a much greater capacity.
    • You can (and should!) use them to store an image of your installation.

    On this last point: this time you could solve your problem with system restore and FixIt. The next time you is maybe not so lucky. You may need to do a full reload of Windows which is tedious and often exceeding the capabilities of the user. By creating a picture now, you will be able to restore Windows to its current state, anything.

    You begin the process of creating image via the control panel / backup and restore.

    If you already have a backup flash drive then you could alternate backups between the flash and drive 500 GB. That would give you a rock solid backup system!

  • error in the application VB 6:-2147217843 - method ' ~' of object ' ~' failed

    I me do 2147217843 - method ' ~' of object ' ~' failed while trying to save with my VB6 Application.

    Recently, I've migrated my WinXP OS for Win 7.

    For Windows 7 Developer related questions, you may be able to receive the best answers in the following forum:
    http://social.msdn.Microsoft.com/forums/en-us/category/WinDev/ releasing It Easy: with Windows | ActiveWin | Laptops | Microsoft MVP

  • When I tried to download my free tril of Adobe Pro, I get an error message "http failed"

    When I tried to download my free trial of Adobe Pro, I get an error message "http failed"

    Adobe is the name of the COMPANY... you hear Premiere Pro or Acrobat Pro?

    kglad links in response to #1 here can help https://forums.adobe.com/thread/2203126

Maybe you are looking for

  • Take folder Midi unpacking

    Why when I unzip my folder takes lunch he created not for each new track channel strips? Right now I am not able to play an individual track - it's all or nothing. I want to be able to each track solo.

  • Share to icloud for photos

    I bought icloud 50 GB of service. I have an iphone 6 plus with IOS 9 and have an ipad 4 with IOS 8.je 17 GB photos and want to reach my lap top (windows 10) from my iphone / ipad for the same photos. I have to upload a photo to see my iPhone 6 more v

  • Need to reboot my laptop each time to get a sound.

    HelloI had a problem with the sound in the operating system Windows 8 (hP G60 model)... Device drivers are installed correctly... !! I have to restart my laptop every time that happens the problem... If I restart the laptop, sound works well... !...

  • Pavillion laptop bat: apps no longer works

    applications on the new computer hp laptop has stopped working although the store shows that it is installed

  • Automatic change of multiplier factor scaling

    I wanted to place an order for synchronization of multiple millisecond of a While loop on the front panel to the sides of a graph of the waveform Strip and be able to vary the value of timing control while the program is running. However, on the mult