/ Forums / Advansys Formativ / Creating Solutions with Formativ / Forwarding/Replying As Attachment

  • Creator
    Topic
  • #4056
    Anonymous

    I need to execute a function only when a reply message or forwarded message has the original message attached to it.

    How do I check to see if a forwarded message (or reply) has the original message attached, or if it is included inline?
    Is there a GroupWise or CurrentItem property that returns this information?

    Thank you.

  • Author
    Replies
  • #6976
    Support 1a
    Participant

    Thank you for your question below.

    As far as I am aware there is no 100% reliable method by which you could determine if the original message is attached (or inlined) in the current message.

    You would probably need to iterate through the attachments collection of the current message looking for attachments of type message. For each message attachment found, you would need to make a determination if the message looked like the original. The subject may be the only common information you could use.

    If no message attachments were found, you would then search the body text of the current message looking for inline message text, extracting the subject, and making the same evaluation. Again, the reliablity of this technique is unknown.

    In both cases you’ll want to work with the CommandMessage object obtained via:

    Set Msg = Client.ClientState.CommandMessage

    This will give you a true Object API message object, making it easy to access it’s attachments collection, etc.

    I hope this helps.

    Advansys Support

    #6977
    Anonymous

    Support 1, thanks for you reply.

    I cannot seem to access the Client.ClientState.CommandMessage (it produces an unknown error).

    My applet launches on the Send event, so I’m assumming the CommandMessage should return the current ComposingItem?
    Or does the CommandMessage only return saved items in the message store?

    Once I’ve referenced an attachment of a current ComposingItem message and determined that it is indeed a message type, how do I access the body of this attached message? Can I treat a message attachment like any message object and use the message object properties on an attachment?

    Thanks.

    #6978
    Support 1a
    Participant

    You won’t be able to access the command message in the OnSend event, because at that time the message does not yet exist in the message store.

    Here’s some sample code I put together that illustrates one way to access the attached message body text. This code contains only basic error checking, but it should point you in the right direction:

    Sub Main(Client, GWEvent)
    
      dim iCount
      dim iIndex
      dim iMsgID
      dim iBody
    
      ' Check we have a composing message available.  They have a message ID of "X00"
      if GroupWise.ItemMessageIDFromView <> "X00" then
        MsgBox "No composing message"
        exit sub
      end if
    
      ' Look for any message attachments
      iCount = GroupWise.ItemAttachmentGetCount("X00")
      if iCount > 0 then
        for iIndex = 0 to iCount - 1
          if GroupWise.ItemAttachmentGetClass("X00", iIndex) = 2 then  ' 2 = Message type attachments
            iMsgID = GroupWise.ItemAttachmentGetName("X00", iIndex)
            MsgBox "Message ID: " & iMsgID,0,"Found Message Attachment"
            iBody = GroupWise.ItemGetText(iMsgID, 10) ' 10 = body text
            MsgBox iBody,0,"Here is the body text"
          end if
        next
      end if
    
    End Sub

    I hope this helps.

    Advansys Support

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