Programmatically retrieving attachments over 64kilobytes

Greetings,

I'm trying to programmatically retrieve an attachment of the image of an e-mail sent to my Blackberry. My problem is that once the attachment is larger than 64 KB, I can't retrieve the data from the BIS server. All my tests is done on living material, and I sign my application.

In my application, I recorded an AttachmentHandler configured to accept the "" image / jpg "' and ' application/octet-stream' types (as suggested here), so the Message Multipart object contains a SupportedAttachmentPart. However, SupportedAttachmentPart.getContent returns an array of length zero * and * SupportedAttachmentPart.hasMore returns false. In addition, the Transport.more call has no apparent effect (so maybe I'm missing something important in this post?)

I think I have read all the existing threads about this, but I must be missing something. Can anyone give me some suggestions / approaches to try?

My test material is a 9000 "BOLD" running 4.6.0.167.

Here are a few test routines that I currently use.

This routine is supposed to read the fixing of the image in memory that I can handle: (not to worry about the memory usage, or multiple attachments, it's just a prototype )

private byte[] getPayload(Message message) {  if (message.getContent() instanceof Multipart) {      Multipart multi = (Multipart) message.getContent();

     System.out.println("in multipart - sz: " + multi.getCount());

       for (int i = 0; i < multi.getCount(); i++) {           BodyPart bp = multi.getBodyPart(i);           if (bp.hasMore()) {               System.out.println("Requesting more");                try {                 Transport.more(bp, true);             } catch (Exception e) {                   // TODO Auto-generated catch block                    e.printStackTrace();              }         }        }

       for (int i = 0; i < multi.getCount(); i++) {           BodyPart bp = multi.getBodyPart(i);           if (bp instanceof SupportedAttachmentPart) {              if (bp.getContent().getClass().isArray()) {                   byte[] content = (byte[]) bp.getContent();                    return content;              }         }     } }

  System.out.println("Found none"); return new byte[0];}

It sends an email with the attached test image (just for completeness)

menu.add(new MenuItem("Email Test",999,0) {

  public void run() {       try {         final Message msg = new Message();            msg.setSubject("Test Picture Attachment");            msg.addRecipient(Message.RecipientType.TO, new Address("[email protected]", "My Phone"));            msg.addRecipient(Message.RecipientType.CC, new Address("[email protected]", "My Gmail"));

          final Multipart parts = new Multipart();

          byte[] imageData = getImageDataFromDisk();

          final TextBodyPart textPart = new TextBodyPart(parts);            textPart.setContent("Cry 'God for Harry, England, and Saint George!'");

         final SupportedAttachmentPart imagePart = new SupportedAttachmentPart(parts);         imagePart.setContentType("image/jpg");            imagePart.setFilename("a.jpg");           imagePart.setContent(imageData);

          parts.addBodyPart(textPart);          parts.addBodyPart(imagePart);

           msg.setContent(parts);

          Transport.send(msg);      } catch (Throwable t) {           t.printStackTrace();      } }});

My attachment handler looks like:

private final class ShowAttachmentHandler implements AttachmentHandler {

    public String menuString() {      return "Show";    }

   public void run(Message m, SupportedAttachmentPart p) {       System.out.println("Attachment Handler Called");  }

   public boolean supports(String contentType) {     if (contentType == null)          return false;

       boolean result = contentType.toLowerCase().indexOf("jpg") != -1;      if (contentType.toLowerCase().indexOf("octet-stream") != -1) {            System.out.println("It's an octet stream");           result = true;        }

       return result;    }}

Thank you!

Just to answer myself: it seems that there is no way to download large attachments programmatically in the 4.x API series, but 5.0 adds AttachmentDownloadManager which does exactly what I'm looking for.

Tags: BlackBerry Developers

Similar Questions

  • Cannot send an email with attachments over 5!

    I use hotmail for my message and can receive a message with attachments over 5 but when I want to send the same message that it limited me to only 5 attachments!  Help?

    Hi DON M MEENGS,.

    The question you posted would be better suited to the community of Hotmail. Please visit the link below to find a community that will provide the support you want.
    http://windowslivehelp.com/solutions.aspx?ProductID=1

  • Is it possible to programmatically retrieve the MAC address of a virtual machine VMware

    Can anyone suggest to programmatically retrieve the MAC address of a VMware virtual machine.

    I need a code for the above features.

    Post edited by: AntonVZhbankov

    Corrected in Hyper-V to VMware

    Now that I have a code in front of me, you can try essentially this:

    
    // MAC Variable
    string MACAddress;
    
    // Get Config Info (hardware)
    vmConfigInfo = (VirtualMachineConfigInfo)myAPI.getProperties(vmRef, new String[1] {"config"});
    
    //Iterate through devices
    foreach (VirtualDevice vDv in vmConfigInfo.hardware.device)
    {
        try
        {
            VirtualEthernetCard mycard = (VirtualEthernetCard)vDv;
            MACAddress = mycard.macAddress;
        }
        catch
        {
        }
    }
    

    Basically what's happening hear, you are pulling all the pieces of virtual hardware and iterate through them. If the piece is a network card, copy the following code will be able to cast an and pull up on the Mac. Otherwise, the cast fails and he is going to move. If you have multiple network cards, you want to add the mac to an array of strings, or something to keep account of more than one.

    This code assumes that you have connected and you have a way to make the configuration of the virtual machine property. The function 'getProperty' in the present code referring to my own function, not one in VMWare. If you don't know how to do this, just post back here and I know there are examples of pages out there anyone can post to explain this part.

  • Why can't open my messages with attachments over? even the 'old' I have already opened in the past. __

    It just happened all of a sudden. attachment get virus scanned but media player still won't pick it up.

    It just happened all of a sudden. attachment get virus scanned but media player still won't pick it up.

    First method: do a system restore, if you remember a good date when you did not have this problem. Choose this good date as your restore point.
    Start button > Search box, type system restore > press the Enter key > uac prompt > click on choose a different restore point > next > select dates as your restore point, until the click > next > finish
    To sit and wait. The machine restarts when it's done.

    If that does not help, please post back and we say what is the extension of this attachment file. The last 3 letters of your attachment represent the file extension. For the benefits of others looking for answers, please mark as answer suggestion if it solves your problem.

  • Retrieve the list of available control values IOName/IVILogicalName

    Is it possible to programmatically retrieve a list of all values of an IOName control (or more precisely IVILogicalName in this case)? I refer to the list of values that appears when you click the arrow on the menu drop-down control. For example, if I set the control to NO-SCOPE (IVI select class-> IviScope-> niScope) from the drop-down list shows only the names of the bodies that are present (for example, "PXI2Slot6"), including the sessions 'duplicate' (e.g. ' PXI2Slot6 (1) ").


    I can get the value currently selected control quite easily, but I would like to get a list of all available values. Is this possible? Values are just there in the control as surely there must be a way to access.

    My goal here is to find a way to recover all sessions IVI and then close them. If there is another way to do this, I'd be happy to hear it.

    Some related posts, I found:
    https://forums.NI.com/T5/instrument-control-GPIB-serial/close-all-open-IVI-sessions/TD-p/1752560
    https://forums.NI.com/T5/Digital-Multimeters-DMMs-and/what-is-the-proper-way-to-close-all-open-Sessi...

    DropDownList (with VI active scripting)

    I use it to find niDMM you can modify it to work with niSCOPE by changing the

    IVI of the results matrix class

    I use this for VISA

  • LabVIEW recover file attachments

    Hi all

    I'm looking for the code example retrieve attachments from Outlook using ActiveX files!

    Please give me some advice!

    Thank you

    Luong.Tran

    Hello Mr President

    Please see the attachment file

    Thank you

  • Cannot access or recover attachments in emails on Hotmail

    Original title: a file has been deleted which allowed us to click on hotmail for msn hotmail button - is no longer can access or retrieve attachments in emails

    Email for hotmail-can't access

    Hello

    I'm sorry, but we cannot help with hotmail problems in these forums in response to vista

    Please repost your question in hotmail in the hotmail link below forums

    http://windowslivehelp.com/product.aspx?ProductID=1

    Forums
     
     

  • How do I programmatically determine the version OMIVV

    How can I programmatically retrieve the version of OMIVV (OpenManage for VMware vCenter integration)?

    That's how I do it manually
    1. connect to https://
    2. in the left menu, select the DEVICE MANAGEMENT
    3 version is displayed under the DEVICE UPDATE

    There is no url in the hyperlink for the management of the unit. This is a javascript action.
    I prefer not to have to hack all the javascript and html to find the source of the information, as this could easily change in a future version, this hack of rendering obsolete.

    There is no SNMP agent
    You can't SSH to the IMO

    I would like to write a script to collect this information on a regular basis as part of the State of my management of environment report.

    Hello

    There is not a way to side plugin to collect the version. You may be able to use other methods of Vcenter for version. PowerCLI should be able to get a list or the specific version of the plugin with the Get-vCenterPlugin command

    https://my.VMware.com/Web/VMware/details?downloadGroup=PCLI550&ProductID=352

  • Recovery of the Service requests of attachments in PL/SQL program

    Hello
    I need to write a PL/SQL program to retrieve attachments of form of Service requests and attachments to users. I was able to identify the details of the "FND_ATTACHED_DOCS_FORM_VL" view attachments but don't know how to recover the attachment of the database files.

    Can anyone let me know the directory path/table/method name to retrieve the attachment of files of the database so that I can use in my PL/SQL program them to Email?

    Thanks in advance for your help,
    Sarah

    Hello
    Attached files are stored in the fnd_lobs table. You need match the ID media of fnd_attached_documents or fnd_documents to file_id in fnd_lobs.
    The document type id data (main table: probably fnd_document_data_types) defines where the attachment is stored.

    It can be fnd_document_short_text, fnd_document_long_text or fnd_lobs. Please use the query below for files:

    SELECT FDT.document_id
    FDT.language
    FDT.source_lang
    FDT.description
    FDT.program_id
    FAD.seq_num
    FAD.entity_name
    FAD.automatically_added_flag
    FAD.program_id
    FAD.pk1_value
    FAD.pk2_value
    FAD.pk3_value
    FAD.pk4_value
    FD.security_type
    FD.publish_flag
    FD.usage_type
    FD.program_id
    null
    fl.file_data
    fl.file_name
    fl.file_content_type
    fl.file_format
    , DECODE (fd.datatype_id, 5, 'W', 6, 'F')
    -, fl.file_data
    OF fdt fnd_documents_tl
    fnd_attached_documents ADF
    fnd_documents fd
    fnd_lobs fl
    WHERE FDT.document_id (+) = FAD.document_id
    AND FAD.document_id = FD.document_id (+)
    AND FD.datatype_id IN (5,6)
    AND fl.file_id = FDT.media_id
    AND FDT.language = 'en '.
    AND FAD.entity_name = 'MTL_SYSTEM_ITEMS ';

  • Size limit of 64 KB in the attachment?

    Hello

    is true that the size of an attachment sent by e-mail via the API cannot be more than 64 k?

    I'm not able to find an official confirm on this on the basis of knowledge of BB / documentation.

    To me, this seems very strange and limiting.

    Thank you and best regards,

    Mike

    Hi Mike,.

    You are right that there is a limit of 64 KB for the reception of attachments by using the prefix "x-rimdevice". This behavior is explained in the following Knowledge Base article:

    What is - delivery content of attachment to a BlackBerry device

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is...

    Also note that with JDE v5.0, there is a new API to programmatically retrieve a file attachment in the same native file format for the file types supported (which may be larger than 64 k).

    For sending e-mail attachments by using the API, there was a limitation of 64 KB before BlackBerry handheld software v4.5, but since version 4.5, the maximum file size is limited by the BIS or BES (default value of 3 MB, but varies according to certain mime types).

    Tariq

  • attachment error more than 7 MB

    Thunderbird 31
    sending attachments over 7 MB said that it is not possible due to the maximum size
    This is because the attachment is converted (of course).
    Previous version worked controlling the original message size limit not on that converted.

    So if before I was able to send 9 fixation bm now I'm not able to send attachment 7 mb

    Sorry for my English, usually I don't use it.

    Cordially Matteo

    Hello.
    Thanks in advance for your help.
    It seems I'm the resolve.
    You ' r right of cource.
    Maybe my provider missing something and have it somewere a configuration problem...
    Thanks again
    Matteo

  • For a sequence in real-time output variable

    VS 2011, I have a sequence of real-time voltage step that sets an AO for a voltage given for awhile, and then resets the output to 0.

    Just before setting the output to 0, I want to read the response of my this stimulus of an AI System I call StepResponse. To do this, I place this in FinalValue I set as a Variable in my script. In other words, it is a parameter or a local Variable.

    Now, how can I get this out FinalValue? I don't see anything on how to "test" this variable to one of my user variable... I was able to do with the stimulus inherited in VS2010 Editor. Now, I'm stumped.

    Here is the sequence:

    and this is the profile of stimulus and settings below. I can set the fine settings via the API of LV, or run the Publisher of the Stimulus. But I can't seem to get out this FinalValue...

    THX.

    L.

    The return for a sequence (in your case FinalValue) variable is returned to the caller once the sequence has been completed as a result of this sequence. In your example, the appellant is stimulus profile that you configured. In a profile of stimulus, two relevant things will come based on the return value of variable a sequence called:

    1. The return variable value will be get recorded in the file of test result ATML for stimulus profile

    2. You can configure an assessment of output for the call to test sequence make a basic on the return variable test to determine a pass/fail result. For a numeric variable to return such as FinalValue, you can do a check of numerical limits to test whether the value is in or out of the specified limits. For a Boolean return value, you can translate either directly in a pass/fail result, or you can reverse the logic as well as False implies Pass.

    In addition, the LabVIEW API has a function, you can call once the sequence finished to programmatically retrieve the return value.

    However, in your sequence after that you store the value StepResponse in the return variable, you reset to zero before the end of the sequence. If your sequence always returns zero. I think that you do not remove this line and let FinalValue what so that you will get the StepResponse back closure instead of zero value.

  • Problem on asynchronous call: façade Subvi is not pop up when it is called.

    Dear all,

    I'm new to LabVIEW, and this is the first time I try to use the asynchronous call.

    I'm using LabVIEW 2011.

    I want to build a directory for several screws, and it should enable users to open more than one of the screws at the same time pressing the buttons. Before the construction of this directory, I just tried asynchronous call allows you to call a form of VI VI, but found a big problem.

    I followed the steps described in the help file, created a strictly typed reference, set the option on 80 x because I need not return. When I run it for the first time, it worked fine: the Subvi popped up and run. Then I closed the Subvi. But for the second time and, when I run the appellant VI, the Subvi does not pop up, instead it seemed to work silently on background because when I manually opened from the file that I found running. In fact, I have found no option as "display front when it is called" of the asynchronous call.

    The appellant VI and Subvi are attached. The address of Subvi calling VI should be amended accordingly.

    What should I do to make it work correctly? Thanks a lot for any idea!

    Linjxz,

    If you have ever thought a solution via the property node, then you can ignore this response.  However the easist if not the best method practice to do what you want is to: with your PS open press ctrl + I, with an "appearance of the window" selected in the drop-down window, click Customize.  Check the box "Display front panel when called" and then the correspondent "close front after ward initially closed".  Mind you as your under VI must begin execution closed to make it work while programmaticly you can over come this obstacle.

    Looking to do more with less code.

    Mark R

  • ListBox problem highlighting

    I'm having a problem with a listbox in 7.1.1.  I have 'item 1' game selection mode.  Sometimes the item highlighted in the list box is changed manually with a mouse click, and sometimes it is changed programmatically.

    My problem is that sometimes shading that indicates the selected item is "blocked" on a selection, so that the previously selected and the new element, are both put in evidence.  This happens with the selected element manual and programmatic changes.  Over time, several elements are highlighted.  The program corrects itself when the scroll bar of the listbox control is moved.  (Programs properly other functions.)

    It seems that it is a matter of labview, which is fine, but I'll give a try to rework my program.  Or maybe there is a work around to prevent it.  I tried to put some functions of waiting and sequence structures in different places to give labview more time to change the Fermata, but nothing seems to work.  ??

    Thank you!

    Greg

    Who could have a bug in the version 7.1.1 of LV

    Hide/show or node invoke > get picture sometimes helps get LV to refresh the screen.

    Ben

  • How to get the category of active screen?

    Hi all

    I have a worker thread that retrieves data over HTTP. Then, I call on the method on the screen to update the different areas.

    Is there a better way to determine the class of the active screen something like that?

    UiApplication.getUiApplication () .invokeLater (new Runnable() {}
    public void run() {}

    Screen = UiApplication.getUiApplication () .getActiveScreen ();
    If (instanceof MyScreen form) {}
    ((MyMainScreen) screen) .someMethod ();
    Screen.Invalidate ();

    }

    });

    Thank you

    Reminder:
    http://www.JavaWorld.com/JavaWorld/javatips/JW-javatip10.html
    listener:
    http://Java.Sun.com/docs/books/tutorial/uiswing/events/index.html (just use the general part).

    If you have several screens you can do it like this:
    create an interface
    create a dataAvailable (...) method that contains the required data as an argument
    Implement the interface in all the screens that need the data
    give your thread a list (vector) of all the screens that implements this interface
    When your thread is finished you iterate in the list, set up the unique element of your interface and call dataAvailable. Don't forget to use invokelater to synchronize on the thread of the event.

Maybe you are looking for

  • Toshiba Canvio fail to mount after a month

    Hi guys,. I have Toshiba Canvio 3T (HDWC130EK3J1) and it worked fine for a month. Now, it will fail to mount. I read on some forums that it could be a power issue. I have USB 2.0 and perhaps need a "cable Toshiba y." I do not understand if I was usin

  • Two monitors with computer desktop Slimline?

    Hello I want to set up two monitors with my HP Slimline.  Is this possible?  I know I have to change the graphics card to accommodate two cords. Slimline s5310f 64 bit NVIDIA GeForce 6150SE nForce 430 LG E2360V LED monitor

  • HP 6510 don't print in black

    Hello I just changed my black ink cartridge and my printer won't print with black ink. Cartridge changed for a new one, but nothing works. Reset the printer, aligning, cleaning, nozzle check, think I have tried almost everything except to buy a new o

  • Unable to connect usb or bluetooth to windows vista

    I am trying to install a programe to enable me transfer contacts, photos etc old mobile phone to the laptop.

  • Reinstalled Vista, now need to reinstall drivers and utilities

    I reinstalled windows vista after a reformat, how do I know if all my drivers and utilities are responsible