The problem appears to be that you are using Object API commands to build most of the message but then you are using a Token command, Call GroupWise.ItemAttachmentAdd(“X00″,115,MessagesID(1),”Test”), to add the attachment.
Unfortunately you cannot mix the types of API commands in this manner. Instead you would use the Object API command to add the attachment. For example, to add a file ‘c:test.txt’ to the message, you would use:
call objDraft.Attachments.Add(“c:test.txt”, fgwFile, “Test”)
To add an existing message, you use:
call objMail.Attachments.Add(Msg, “Description”)
I hope this helps.