/ Forums / Advansys Formativ / Creating Solutions with Formativ / Email attachment property

  • Creator
    Topic
  • #3872
    wozza
    Participant

      Could anyone tell me if there is a property for email attachments under the ComposingItem property (i.e. attachments to an email in the process of being written)?
      I’ve worked out how to save an email as a text file to a nominated folder before it is actually sent (we can keep a record in the actual job folder) and I would like the text file to include a list of all attachments.

      Thanks in advance…

      Wozza

    • Author
      Replies
    • #6459
      Support 2
      Moderator

        The following sample code which will display the composing message’s attachment name(s) in a message box. It will also allow you to save an attachment but you will need to uncomment the ItemAttachmentSaveAs ‘save’ code and provide the target file name (this code would have to be updated to handle multiple filenames and check whether the file already exists).

          dim iMsgID
        dim iAttachCounter

        Const CAPTION = "Formativ Business Solutions"

        ' Get the composing message ID through TOKEN
        iMsgID = GroupWise.ItemMessageIDFromView

        ' Make sure we have a composing message selected
        if (iMsgID = "X00") then
        iAttachCounter = GroupWise.ItemAttachmentGetCount(iMsgID)

        ' Does the message have any attachments?
        if (iAttachCounter > 0) then
        ' Loop through attachments to get the names
        for x = 0 to (iAttachCounter -1)
        call msgbox (GroupWise.ItemAttachmentGetName(iMsgID, x), vbInformation, CAPTION)

        ' To save the attachment(s), you need to provide the file name(s) and have to check whether
        ' the file already exists
        'call GroupWise.ItemAttachmentSaveAs(iMsgID, x, "c:test.txt")
        next
        else
        call msgbox("No attachments found.", vbInformation, CAPTION)
        end if
        else
        call msgbox("Select a composing message to display the attachment names.", vbInformation, CAPTION)
        end if

        Hope this helps.

        Regards,

        Advansys Support

        #6460
        wozza
        Participant

          [QUOTE]Originally posted by Support 2:
          The following sample code which will display the composing message’s attachment name(s) in a message box…

          Excellent! Thanks very much for that. I can tweak it to suit our requirements. And thanks for such a prompt answer – it has saved me a lot of wasted time.

          Wozza

          #6458
          Support 2
          Moderator

            Thanks, no problem. Let us know if you have any further questions.

            Regards,

            Advansys Support

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