/ Forums / Advansys Formativ / Creating Solutions with Formativ / Programmatically accept an appointment / Reply To: Programmatically accept an appointment

Support 2

We hope the following code may help. Let us know if it does not.

const IDS_SELECT_APPT_MSG       = "Select a posted personal appointment message to proceed."    
const IDS_SELECT_MSG            = "Select a message to proceed."
const IDS_MSG_CREATED           = "Message created."
const IDS_CAPTION               = "Formativ Business Solutions"  
' Main line processing
Sub Main(Client, GWEvent)
  dim iMsg
  dim iNewMsg
  dim iCloneMsg
  On Error Resume Next
  Set iMsg = Client.ClientState.CommandMessage
  if isobject(iMsg) then    
    ' Do we have an appointment message?
    if (instr(1, iMsg.ClassName, "GW.MESSAGE.APPOINTMENT", vbTextCompare) <> 0) then
      ' Clone the message
      set iCloneMsg = iMsg.Clone      
      iCloneMsg.subject = "This is the clone message"
      ' Adds an existing Message object to this collection. (This method is available only in GroupWise 6.0, SP1 and later versions) 
      set iNewMsg = groupwise.account.Calendar.Messages.AddExistingMessage(iMsg.sender.displayname, iMsg.sender.emailaddress, "NGW", iMsg.CreationDate, fgwPersonal, 0, fgwNormal, 0, iCloneMsg, iMsg.ModifiedDate)      
      call msgbox(IDS_MSG_CREATED, vbInformation, IDS_CAPTION)
      call msgbox(IDS_SELECT_APPT_MSG, vbInformation, IDS_CAPTION)  
    end if    
    call msgbox(IDS_SELECT_MSG, vbInformation, IDS_CAPTION)  
  end if
  set iMsg = nothing
  set iNewMsg = nothing
  set iCloneMsg = nothing
End Sub