/ Forums / Advansys Formativ / Creating Solutions with Formativ / How can I move an attachment into a GW folder?

  • Creator
    Topic
  • #4330
    dgerisch
    Participant

      I have an automated routine that sends mail to a particular mailbox. I used Formativ, and created an applet that does a Forward As Attachment to take the message of interest and deliver it to the particular mailbox. This all works well.

      What I want to do next is to open the message in the destination mailbox, and then copy the attachment to another GroupWise folder. The attachment is actually always a GW message, and I can tell that it has a GW message ID. How can I copy/move the attachment (an attached GW mail message) into a GroupWise folder?

      If it helps to understand what I am doing, the messages of interest are spam, and the destination folder in GroupWise is accessed by IMAP by the anti-spam software to train against. The first Formativ applet forwards the spam as an attachment to the training mailbox, and I want to write another applet to copy those attachments into the training mailbox SPAM folder.

      Thanks!

    • Author
      Replies
    • #7842
      Support 3
      Participant

        This is one of the limitation to the GroupWise API to not allow to move attached message. Not sure about whether there is any method exists in SOAP API.

        Just to see whether any changes in GW 7.0.2, I have tried the following sample code to move the attached message (I have a plain text message with an embedded message) but it failed with error message “An invalid argument was passed in the function call.”. I have comment-out the code to move the root message which works.

          
          dim oMsg
          dim oSourceFolder
          dim oDestinationFolder
        
          ' Destination folder
          set oDestinationFolder = groupwise.account.allfolders.itembyname("Notes")
        
          ' selected message which contains the attach message.
          set oMsg = client.clientstate.commandmessage
        
          ' Access message source folder
          set oSourceFolder = oMsg.EnclosingFolders.item(1)
          msgbox "Source Folder: " & oSourceFolder.name
        
          ' Access the attach message
          set oAttachment = oMsg.attachments(1)
          msgbox "Attachment: " & oAttachment.displayname
        
          ' Move the attach message to a destination folder (DOES NOT WORK)
          if (oAttachment.ObjType = 2) then
            msgbox oAttachment.message.messageid
            call oSourceFolder.messages.move(oAttachment.message.messageid, oDestinationFolder.messages)
          end if
        
          ' Works: Move root message to destination folder
          'call oSourceFolder.messages.move(oMsg.messageid, oDestinationFolder.messages)
        
          set oDestinationFolder = nothing
          set oSourceFolder = nothing
          set oAttachment = nothing
          set oMsg = nothing
        

        As this type of enquiry is related to the groupWise API, you may consider to post a message to the Novell Developer Support forum (http://forums.novell.com/category/developer.tpt).

        Regards,
        Advansys Support

        #7838
        dgerisch
        Participant

          Thank you very much for giving it a try. I’ve been getting error messages, but I don’t know the system well enough to be able to tell if it was a syntax error on my part, or a “doesn’t work, as designed” limitation of the API.

          I really appreciate you guys working out the solution (even if the answer is “it’s broken”)

          Thank you very much.

          #7841
          Support 3
          Participant

            Thanks for your feedback.

            Regards,
            Advansys Support

            #7839
            dgerisch
            Participant

              Markus out in the Novell Object API Forum pointed out that I could clone the attachment as a new message, and move that to the folder I want. So I used the code you wrote, added a little bit, and it works. 🙂

              
                ' Move the attach message to a destination folder (WORKS)
                if (oAttachment.ObjType = 2) then
                  msgbox oAttachment.message.messageid
                  set oAttachmentClone = oAttachment.message.Clone
                  call oSourceFolder.messages.move(oAttachmentClone.messageid, oDestinationFolder.messages)
                end if
              
              
              #7840
              Support 3
              Participant

                Thanks for sharing your ideas. Keep up the good work Smile.

                Regards,
                Advansys Support

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