/ Forums / Advansys Formativ / Creating Solutions with Formativ / Syntax for Accessing Forwarded Messages / Reply To: Syntax for Accessing Forwarded Messages

#6440
Support 2
Moderator

    Hi,

    One of our engineers has written the following sample code which we hope will assist. Please let us know if you have any further questions.

    '-------------------------------------------------------------------------------
    ' This sample code will display a selected message's subject. If the selected message
    ' contains any message type attachments (ObjType = fgwMessage),
    ' the code below will display the attachment's subject and the body text.
    '-------------------------------------------------------------------------------

    Sub Main(Client, GWEvent)

    HRT = Chr(13) & Chr(10)

    on error resume next
    Set objMsg = Client.ClientState.CommandMessage

    if isobject(objMsg) then

    msgbox "Selected message's subject: " & objMsg.Subject & HRT &_
    "Total attachments: " & objMsg.Attachments.count

    if objMsg.Attachments.count > 0 then
    for y = 1 to objMsg.Attachments.count
    set FordwardMsg = objMsg.Attachments(y)

    ' If the attachment is a message type then proceed
    if FordwardMsg.ObjType = fgwMessage then
    msgbox "Attachment's subject: " & FordwardMsg.Message.Subject & HRT &_
    "Message: " & FordwardMsg.Message.BodyText
    end if

    set FordwardMsg = nothing
    next
    end if
    else
    msgbox "Select a message to continue."
    end if

    set objMsg = nothing

    End Sub

    Regards,

    Advansys Support