/ Forums / Advansys Formativ / Creating Solutions with Formativ / Force GroupWise to open the application for an attachment / Reply To: Force GroupWise to open the application for an attachment

#6885
Support 1
Participant

    Formativ can be used to open a file attachment using the Windows file association, as shown in the applet example below. This example should be launched from a toolbar button on an open message view.

    ' GroupWise integrations should include the toolbar for all required message
    ' types.  Note that setting this integration will require restarting GroupWise.
    sub Main(Client, GWEvent)
    
      dim iFileName
      dim iFound
      dim iIndex
      dim oAttachment
      dim oMsg
    
      set oMsg = Client.ClientState.CommandMessage
      if IsObject(oMsg) then
        iFound = false
        iIndex = 1
        do while (iIndex <= oMsg.Attachments.Count) and (not iFound)
          if oMsg.Attachments(iIndex).ObjType = fgwFile then
            iFound = true
          else
            iIndex = iIndex + 1
          end if
        loop
    
        if iFound then
          set oAttachment = oMsg.Attachments(iIndex)
          iFileName = oAttachment.FileName
          if iFileName <> "" then
            iFileName = Utilities.TempFiles & iFileName
            call oAttachment.Save(iFileName)
            call Utilities.OpenDocument(iFileName)
          else
            iFound = false
          end if
          set oAttachment = nothing
        end if
    
        if not iFound then
          call MsgBox("Cannot find a file attachment.", vbInformation, "Open Document")
        end if
      end if
    
      set oMsg = nothing
    
    end sub

    I hope this helps.

    Advansys Support