No announcement yet.

id/object of selected message(s)

  • Filter
  • Time
  • Show
Clear All
new posts

  • id/object of selected message(s)


    how do I get get the current selected message(s), e.g. the id to open a reply-dialog? OXMailHover.actualobject is not defined? :/



    ok, i found mail_message contains the OXMailObjectCache of the current selected mail. But it only seems to contain the first selection?
    Last edited by HansMaulwurf; 08-06-2012, 10:46 AM.

  • #2
    The set of currently selected mails is stored in a local variable. It can't be accessed from outside of js/mail.js.


    • #3
      Aww, I knew it. Is it possible to rebuild such a structure on my own? I see there is some work with "var mailSelection = new Selection2();"
      But I don't get how to use it to get mailSelection.getSelected()


      • #4
        I don't know if you need the selection object, but if not, there is the global event "Selected" which is called with an array of selected object IDs as parameter (not only for mail), and the global variable menuselectedobjects which is automatically updated with that array, as long as the user is in the mail module. Both are ugly hacks and might be replaced with a real API, but until then, they're the only way.


        • #5
          Oh yes, menuselectedobjects works. Is it possible to use menuselectedobjects[0]["id"] to get the whole mailobject to access subject, msg-id and so on? Because sometimes (when I click on an email at the startpage), menuselectedobjects gives only module, id, folderid and hash.


          • #6
            No. It is guaranteed to contain only the folder ID and mail ID. Use OXCache.newRequest to retrieve the entire object or the fields you actually need.


            • #7
              Great, newRequest is what I need thank you

              Is it possible to contact you by any IM? Sometimes it would be much faster than here, especially if I need only little hints.


              • #8
                I know, I said this is solved, but is there a way to get to more than one selected object? menuselectedobjects is holding only the first item.


                • #9
                  menuselectedobjects is an array containing the IDs of all selected mails. Why do you think that it contains only the first one?


                  • #10
                    You're right, sorry. Stared yesterday too long at the sourcecode. Today everything is working fine and logical. I remember I did this already ... have to save my findings somewhere.