Please login to access all of the features of the Community Site.

AddEventToCalendar

M v3.0

You finally did it. You built that (almost) perfect calendar event detail page. It looks pretty, it shows all the information. You even got the time zone right! If only you could have that "Add to Calendar" button like everybody else.

Well, now your calendar event detail page can be perfect. This command allows you to specify all the details of a one-time event and add it to the user's default calendar.

The first time this command (or any other that accesses the calendar) is used it will prompt the user to allow access to their calendars.

Properties

PropertyTypeDescription
StartDateTimeDateTimeThe start date and time of the event. If you provide any time zone information here it will be ignored.
EndDateTimeDateTimeThe end date and time of the event. If you leave this blank then the time information from the StartDateTime will be dropped and it will become an all day event.
TitlestringThe title (or name) of the event. Space is often limited when displaying the title so remember to keep it short.
NotesstringAdditional notes about the event. Think of this as the details when opened information.
LocationstringThe location of the event. This can technically be anything you like such as "Main Auditorium", but if you put in an actual address then devices will usually make it link to the maps application.
UrlstringA URL that the user can follow to get more information about the event.
TimeZoneIdstringThe IANA time zone identifier that the StartDateTime and EndDateTime are in. For example, "America/Phoenix". Time zone reference sheet
AlarmInMinutesintIf set then an alarm will be added to the event that triggers this many minutes before the event happens.

The following properties are required at a bare minimum:

  • StartDateTime
  • Title
  • TimeZoneId
<Button Text="Add to Calendar"
    Command="{Binding AddEventToCalendar}">
    <Button.CommandParameter>
        <Rock:AddEventToCalendarParameters Title="Rock Solid Finances Class"
            StartDateTime="2021-07-04 18:30:00"
            EndDateTime="2021-07-04 20:00:00"
            Location="3120 W Cholla St, Phoenix AZ, 85029-4113"
            Url="https://www.rocksolidchurchdemo.com/page/414?EventOccurrenceId=3"
            TimeZoneId="America/Phoenix" />
    </Button.CommandParameter>
</Button>