Anyone have a Procedure to produce a Calendar Invite in 6?

I have searched everywhere for a reference to calendar invites in the forums, Google, etc. to no avail. If it’s been discussed already, I can’t find it. So I feel it is safe to ask a question I would think someone has already solved.

I built my CRM system over the last 25 years using Panorama and am now constantly getting asked to provide calendar invites to my customers. Before I dive into the lengthy project of building my own generating procedure (adherent to RFC 5545: Internet Calendaring and Scheduling Core Object Specification (iCalendar) ), I was hoping someone had already tackled it.

Of course, if no one has, I would be happy to supply the end result to the community.

Hopefully,

Greg

If you’re referring to the ics files that can be included in an email, I’ve been doing them in Pan 6 and now in Pan X. It’s not as complex as the reference you found, but more than a quick post here would cover. I got it working originally by reverse engineering the internal structure of ics files created by other apps, then using Panorama to handle the data and save it as a .ics file, and it has worked very reliably.

Without explanation, here’s my code for it. Okay, I will explain that “fg” designates a file global with those values coming from a Panorama form.

Local lviCal, lvName, lvFolder
lviCal = “BEGIN:VCALENDAR
METHOD:PUBLISH
VERSION:2.0
PRODID:-//Head4Web.com//Calendar//EN
BEGIN:VEVENT
SUMMARY:”+fgEvent+“
UID:”+str(now())+“
STATUS:CONFIRMED
DTSTART:”+datepattern((fgStartDate),"YYYYMMDD")+“T”+Timepattern(Time(fgStartTime),"HHMMSS")+“
DTEND:”+datepattern(?(fgEndDate=0,fgStartDate,fgEndDate),"YYYYMMDD")+“T”+Timepattern(Time(fgEndTime),"HHMMSS")+“
LOCATION:”+fgLocation+“
URL:”+fgURL+“
DESCRIPTION:”+fgNote+“
END:VEVENT
END:VCALENDAR”

lvName = datepattern((fgStartDate),"YYYYMMDD")+“-”+Timepattern(Time(fgStartTime),"HHMMSS")+".ics"
savefiledialog lvFolder,lvName,"Save as..."

filesave lvFolder,lvName,"TEXTttxt",lviCal

You can also interface with the Mac Calendar app quite readily using Applescript. Although it’s old, the info at this MacTech page is still valid. I use it to set appointments in my Calendar with reminders or anything else offered by Calendar.

1 Like

Thanks, James!

Just what I was looking for. I’ll put it to good use.

Best,

Greg

// The following variables can be temporarily used to test the code below that was written by James Cook with minor modifications by Robert Ameeti.

Let fgEvent = "Dentist" ; A text string representing the name of this particular event.
Let fgStartDate = today() ; A date represented as a number (Remember: Panorama stores dates as numbers.) or today()
Let fgStartTime = "0745" ; A text string representing a number ('0800' for 8 am)
Let fgEndDate = today()+1 ; A date represented by a number (Panorama stores dates as numbers.)
Let fgEndTime = "0845" ; A text string representing a number representing a time of day ('1030' for 10:30 am)
Let fgLocation = "422 S Mansfield Ave" ; An address or facility name.
Let fgURL = "https://www.WheresTheDance.com"
Let fgNote = "Persevere and you will be rewarded."
// lvFolder ; If you want a folder other than the default location which is the same directory as the db.

Local lviCal, lvName, lvFolder
lviCal = “BEGIN:VCALENDAR
METHOD:PUBLISH
VERSION:2.0
PRODID:-//Head4Web.com//Calendar//EN
BEGIN:VEVENT
SUMMARY:”+fgEvent+“
UID:”+str(now())+“
STATUS:CONFIRMED
DTSTART:”+datepattern((fgStartDate),"YYYYMMDD")+“T”+("0"+Strip(Timepattern(Time(fgStartTime),"HHMMSS")))[-6,-1]+“
DTEND:”+datepattern(?(fgEndDate=0,fgStartDate,fgEndDate),"YYYYMMDD")+“T”+("0"+Strip(Timepattern(Time(fgEndTime),"HHMMSS")))[-6,-1]+“
LOCATION:”+fgLocation+“
URL:”+fgURL+“
DESCRIPTION:”+fgNote+“
END:VEVENT
END:VCALENDAR”
lvName = datepattern((fgStartDate),"YYYYMMDD")+“-”+("0"+Strip(Timepattern(Time(fgStartTime),"HHMMSS")))[-6,-1]+".ics"
savefiledialog lvFolder,lvName,"Save as..."
filesave lvFolder,lvName,"TEXTttxt",lviCal

The above code should be able to be run with the result being a working .ics file with a 25 hour dentist appointment. :wink:

James…
What does the ‘PRODID:’ accomplish?

I found that if I used a time such as 0800, that the timePattern( is not forcing the leading zero and everything went awry, so I did muck with your code to force that leading zero.

As for Location; When using the Calendar app, if a user is manually creating an event and enters a location that is either in their Contact app, or that Apple knows about, the address gets entered with 2 lines and it gets linked to the actual address in Maps. Had you had any luck in getting a 2nd line in the Address field? Did you accomplish any map linking?

This Stack Overflow post provides some information about this VCal field.

https://stackoverflow.com/questions/77061260/prodid-in-ical-header