/ Forums / Advansys Formativ / Creating Solutions with Formativ / How to open calendar on a specific date / Reply To: How to open calendar on a specific date

#6961
Support 1
Participant

Thank you for your enquiry.

In the following, I make the following assumptions; that you require:

  • a new button on the GroupWise client main toolbar;
  • the appointment to be selected in the message list;
  • clicking the new button opens a calendar view matching the appointment start date.
'-------------------------------------------------------------------------------
const VIEWTYPE_CALENDAR = 1

Sub Main(Client, GWEvent)

  dim iStartDate
  dim oMessage

  ' Suppress error handling on .CommandMessage if no message is selected.
  on error resume next

  set oMessage = nothing ' initialize to something we can compare
  set oMessage = Client.ClientState.CommandMessage

  ' Turn on error handling.
  on error goto 0

  if oMessage is nothing then
    MsgBox("There is no message selected.")
  else
    ' Ensure it's an appointment.
    if InStr(1, oMessage.ClassName, "GW.MESSAGE.APPOINTMENT", vbTextCompare) = 1 then
      iStartDate = oMessage.StartDate
      call GroupWise.ViewOpenNamed("Appt (sm)", VIEWTYPE_CALENDAR, "")
      call GroupWise.DateAbsoluteGoTo(Day(iStartDate), Month(iStartDate), _
        Year(iStartDate))
    else
      MsgBox("Your selected message is not an appointment.")
    end if
  end if
  set oMessage = nothing

End Sub
'-------------------------------------------------------------------------------

You can see the available view names, like ‘Appt (sm)’, listed in the drop-down menu of the Open Calendar button on the GroupWise toolbar.

I hope this helps.

Advansys Support