• Creator
    Topic
  • #4597
    wozza
    Participant

      Is it possible to access the attachment property from within the ComposingItem property?

      Wozza

    • Author
      Replies
    • #8506
      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

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