/ Forums / Advansys Formativ / Creating Solutions with Formativ / Accessing the currently selected attachment

  • Creator
    Topic
  • #4458
    jasonchild
    Participant

      Hi, I’m a formativ newbie and am trying to author a simple solution that will allow me to save the currently selected attachment to a directory specified by a registry key.

      I have figured how to do everything I need *except* for being able to access the currently selected attachment. I can access the currently selected message no probs as per the programmers guide for Context.ClientState.SelectedMessages.Count
      etc… But I cannot see a way to get the currently selected attachment.

      After reading the language guide I found the GroupWise.ItemAttachmentGetCurrentIndex() method, but when I call it in the code the following error is returned:

      ‘Token failed execution!’ is not a valid integer value at line 28, column 3.

      I simply called:

      Dim x
      x = GroupWise.ItemAttachmentGetCurrentIndex()

      And yes, I have an attachment selected when running this code. Any thoughts?

      Kind Regards,

      Jason

    • Author
      Replies
    • #8224
      Support 3
      Participant

        Message view must be open to get the current selected attachment index. Please see the Novell Token API documentation for more information:
        http://developer.novell.com/documentation/gwtoken/index.html?gwtokens/data/hj8ej8g5.html

        Following information copied from the Novell Token API documentation:

        quote:


        ItemAttachmentGetCurrentIndex()

        Returns the current attachment index. The item view must be open with the attachment selected.
        Token ID

        AFTKN_ITEM_ATTACHMENT_CURRENT or 758

        Syntax

        WORD ItemAttachmentGetCurrentIndex()

        Return Values

        WORD. Current attachment index (zero-based).


        If you have the message view opened then you can use following code to get current attachment index and save the attachment.

          
          messageID = groupwise.ItemMessageIDFromView
          attachmentIndex = groupwise.ItemAttachmentGetCurrentIndex
        
          fileName = groupwise.ItemAttachmentGetDisplayName(messageID, attachmentIndex)
        
          call groupwise.ItemAttachmentSaveAs(messageID, attachmentIndex, "c:temp" + fileName)
        

        FYI, to make easier for the developer, Formativ wrap most of the GroupWise Tokens. For example:
        GroupWise.ItemAttachmentGetCurrentIndex()

        Formativ also provide option to call directly the token using the ThrowToken() method:
        msgbox groupwise.throwtoken(“ItemAttachmentGetCurrentIndex()”, iRetunVal)

        See the Formativ Language Guide for more information.

        Regards,

        Advansys Support

        #8228
        jasonchild
        Participant

          Thanks for your response, I see now that the token works fine when the e-mail message has been fully opened and selecting the attachment.

          However I guess what I am trying to achieve is a way to interact with a specific attachment from the preview pane. Is there anyway to achieve this?

          Kind Regards,

          Jason

          [This message was edited by jasonchild on October 03, 2011 at 05:40 PM.]

          #8229
          Support 3
          Participant

            Unfortunaletly, we don’t think any GroupWise Token available to return selected attachment index/information from preview pane.

            A workaround solution could be list available attachments from a selected message in a dialog (list box) then let user to select specific attachment to save. You can use GroupWise Object APIs to access attachments information where you will have more control, applet can be integrate to GroupWise toolbar.

            Regards,

            Advansys support

            #8227
            jasonchild
            Participant

              Thank you for your response. And yes, this is the approach I have already taken in the interim. It is just a little surprising and disappointing that GroupWise has not provided for this functionality.

              Thank you however for your time.

              Kind Regards,

              Jason.

              [This message was edited by jasonchild on October 05, 2011 at 05:22 PM.]

              #8225
              Support 3
              Participant

                We recommend you to post a feature request in Novell forum: http://forums.novell.com/novell/product-neutral/developers/

                We also will request this feature to our Novell contacts.

                Regards,
                Advansys Support

                #8223
                jasonchild
                Participant

                  At the risk of repeating myself, Thank you very much! Its nice to know that I wasn’t overlooking the obvious when searching for the solution to my problem.

                  As such, I have taken your advice and posted an enhancement request via the Novell Enhancement Portal. The request link is as follows for ticket https://secure-www.novell.com/rms/rmsTool?action=WwwActions.viewPropsPage&reqId=56770

                  One question, if Novell chooses to accept this request, would there be a requirement for your client to expose any new tokens that may be created as a result? Or would they be accessible via another means such as the groupwise.throwtoken method described above?

                  Kind Regards,

                  Jason Child

                  #8226
                  Support 3
                  Participant

                    You can use Groupwise.ThrowToken() to execute new/existing tokens. Please see the Formativ Language Guide for more information. Information below copied from the Language Guide.

                    quote:


                    Uses the native GroupWise Token Commander to execute the given token. The return value from the token is given in the ResultValue parameter.

                    Syntax

                    boolean groupwise.ThrowToken(TokenSyntax string, ResultValue variant)

                    Parameters
                    TokenSyntax – String
                    ResultValue – Variant


                    Regards,

                    Advansys Support

                  Viewing 7 replies - 1 through 7 (of 7 total)
                  • You must be logged in to reply to this topic.