Support 1a

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
  end if

End Sub

I hope this helps.

Advansys Support