/ Forums / Advansys Formativ / Creating Solutions with Formativ / Message Reference from Reply / Reply To: Message Reference from Reply
June 26, 2008 at 5:36 pm
#8000
Your code review shows that you did not call the GetWIPFolderPath from the main subroutine prior to save the message. The following code works fine in our environment. Let us know if we missed anything…
Sub Main(Client, GWEvent)
dim iWIPFolderPath
dim oMsg
dim iMsgID
dim iWIPPath
Dim iBreakCount
' Save the draft message to the Work in Progress folder
Call Groupwise.ItemSetText("X00", itfSubject, " COMPLETED", TRUE) ' TRUE = Append
call GetWIPFolderPath(groupwise.account.workfolder, iWIPPath)
msgbox "Work In Progress folder path: " & iWIPPath
Call Groupwise.throwtoken("ItemSaveMessageDraft(""" & iWIPPath & """)", iReturnVal)
' Calling ItemMessageIDFromView immediately after GroupWise.ItemSaveMessageDraft
' can result in an X00 ID.
iMsgID = GroupWise.ItemMessageIDFromView
iBreakCount = 0
while (iMsgID = "Token failed execution!") or (iMsgID = "X00")
Application.ProcessMessages
utilities.Timer(1)
Application.ProcessMessages
iMsgID = GroupWise.ItemMessageIDFromView
iBreakCount = iBreakCount + 1
Utilities.Trace iBreakCount & ": " & iMsgID
if (iBreakCount > 10) then
exit sub
end if
wend
set oMsg = GroupWise.Account.GetMessage(iMsgID)
msgbox "Subject: " & oMsg.subject.plaintext
End Sub
'-------------------------------------------------------------------------------
' Get full path of the Work-In-Progress folder where Drafts are saved
'-------------------------------------------------------------------------------
Function GetWIPFolderPath(aGWFolder, byref aPath)
Dim sHome
sHome = ""
Utilities.Trace "aGWFolder.Name=" & aGWFolder.Name & " aPath=" & aPath
If (Cint(Left(GroupWise.EnvVersionName,1)) >= 7) Then
If aGWFolder.Name = GroupWise.Account.Owner.DisplayName Then
sHome = " Home"
End If
End If
If aGWFolder Is Nothing Then
Exit Function
End If
If (aPath <> "") Then
aPath = aGWFolder.name & sHome & "" & aPath
Else
aPath = aGWFolder.name
End If
If (aGWFolder.objtype = fgwRoot) Then
Exit Function
Else
Call GetWIPFolderPath(aGWFolder.ParentFolder, aPath)
End if
End Function
BTW, you can use the custom fields to store data or insert the data to the message body. If the data is sensitive then you can consider to encrypt and decrypt at the other end by your solution.
Most probably in GroupWise 8 (Bonsai) will have the X-Fields where you can add additional data and viewable by other non GroupWise clients.
Hope this helps.
Regards,
Advansys Support