Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating an iCalendar.ics file
Message
From
13/03/2014 10:28:41
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Web
Miscellaneous
Thread ID:
01596024
Message ID:
01596452
Views:
74
This message has been marked as the solution to the initial question of the thread.
Hi Chris.

>I am building a routine that creates iCalendar ICS files from data in a VFP database. Basically VEVENT entries only. I am curious if others have already done this and can comment on required content (UID, DTSTAMP, ORGANIZER for example) or the need for VTIMEZONE use, or any issues that you have encountered.

Here's the code I used to generate ICS files for SWFox. Of course, it'll have to be tweaked for your needs.
lnTimeZoneOffset = 7 * 60 * 60
	&& Phoenix is 7 hours behind GMT.
scan for not empty(cAbbrev)
	lcStart    = chrtran(ttoc(tStart + lnTimeZoneOffset, 3), '-:', '') + 'Z'
	lcEnd      = chrtran(ttoc(tEnd   + lnTimeZoneOffset, 3), '-:', '') + 'Z'
	lcTitle    = trim(cAbbrev) + iif(empty(nvl(cSpeaker, '')), '', ' - ' + trim(cSpeaker))
	lcDescrip  = strtran(trim(mAbstract), chr(10) + chr(13), '=0D=0A')
	lcLocation = trim(cRoom)
	lcID       = 'SWFOX' + lcStart
	text to lcContent noshow textmerge pretext 2
	BEGIN:VCALENDAR
	VERSION:2.0
	CALSCALE:GREGORIAN
	X-WR-TIMEZONE:America/Phoenix
	BEGIN:VEVENT
	DTSTART:<<lcStart>>
	DTEND:<<lcEnd>>
	SUMMARY;ENCODING=QUOTED-PRINTABLE:<<lcTitle>>
	DESCRIPTION;ENCODING=QUOTED-PRINTABLE:<<lcDescrip>>
	LOCATION;ENCODING=QUOTED-PRINTABLE:<<lcLocation>>
	UID:<<lcID>>
	PRIORITY:3
	END:VEVENT
	END:VCALENDAR
	
	endtext
	strtofile(lcContent, lcICSFolder + transform(iID) + '.ics')
endscan for not empty(cAbbrev)
Doug
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform