Search This Blog

Tuesday, September 29, 2009

Create iCalender using PeopleCode

Its all about creating and iCalender which is compatible with Outlook. You can send mail to whomever it is concerned with the .ics file as an attachment. The person can open the .ics file and save to the outlook calendar. That's called collaborative flexibility

Below are the core objects for creating an ics file:

Here is a simple example of an iCalendar object, "Bastille Day Party" event which occurs July 14, 1997 17:00 (UTC) through July 15, 1997 03:59:59 (UTC):

BEGIN:VCALENDAR

VERSION:2.0

PRODID:-//hacksw/handcal//NONSGML v1.0//EN

BEGIN:VEVENT

DTSTART:19970714T170000Z

DTEND:19970715T035959Z

SUMMARY:Bastille Day Party

END:VEVENT

END:VCALENDAR


 

To-do (VTODO)

VTODO explains a to-do item, i.e., an action-item or assignment.

The following is an example of a to-do due on April 15, 1998
An audio alarm has been specified to remind the calendar user at noon, the day before the to-do is expected to be completed and repeat hourly, four additional times. This to-do has been modified twice since it was initially created.

BEGIN:VCALENDAR

VERSION:2.0

PRODID:-//ABC Corporation//NONSGML My Product//EN

BEGIN:VTODO

DTSTAMP:19980130T134500Z

SEQUENCE:2

UID:uid4@host1.com

ORGANIZER:MAILTO:unclesam@us.gov

ATTENDEE;PARTSTAT=ACCEPTED:MAILTO:jqpublic@example.com

DUE:19980415T235959

STATUS:NEEDS-ACTION

SUMMARY:Submit Income Taxes

BEGIN:VALARM

ACTION:AUDIO

TRIGGER:19980403T120000

ATTACH;FMTTYPE=audio/basic:http://example.com/pub/audio-

files/ssbanner.aud

REPEAT:4

DURATION:PT1H

END:VALARM

END:VTODO

END:VCALENDAR


 

Journal entry (VJOURNAL)

VJOURNAL is a journal entry. They attach descriptive text to a particular calendar date, may be used to record a daily record of activities or accomplishments, or describe progress with a related to-do entry. A "VJOURNAL" calendar component does not take up time on a calendar, so it has no effect on free or busy time (just like TRANSPARENT entries). In practice, few programs support VJOURNAL entries, although examples exist: Plum Canary's Chirp software uses VTODO and VJOURNAL together.

The following is an example of a journal entry:

BEGIN:VCALENDAR

VERSION:2.0

PRODID:-//ABC Corporation//NONSGML My Product//EN

BEGIN:VJOURNAL

DTSTAMP:19970324T120000Z

UID:uid5@host1.com

ORGANIZER:MAILTO:jsmith@example.com

STATUS:DRAFT

CLASS:PUBLIC

CATEGORY:Project Report, XYZ, Weekly Meeting

DESCRIPTION:Project xyz Review Meeting Minutes\n

Agenda\n1. Review of project version 1.0 requirements.\n2.

Definition

of project processes.\n3. Review of project schedule.\n

Participants: John Smith, Jane Doe, Jim Dandy\n-It was

decided that the requirements need to be signed off by

product marketing.\n-Project processes were accepted.\n

-Project schedule needs to account for scheduled holidays

and employee vacation time. Check with HR for specific

dates.\n-New schedule will be distributed by Friday.\n-

Next weeks meeting is cancelled. No meeting until 3/23.

END:VJOURNAL

END:VCALENDAR


 

Free/busy time (VFREEBUSY)

VFREEBUSY is a request for free/busy time, is a response to a request, or is a published set of busy time

The following is an example of published busy time information.:

BEGIN:VCALENDAR

VERSION:2.0

PRODID:-//RDU Software//NONSGML HandCal//EN

BEGIN:VFREEBUSY

ORGANIZER:MAILTO:jsmith@example.com

DTSTART:19980313T141711Z

DTEND:19980410T141711Z

FREEBUSY:19980314T233000Z/19980315T003000Z

FREEBUSY:19980316T153000Z/19980316T163000Z

FREEBUSY:19980318T030000Z/19980318T040000Z

URL:http://www.host.com/calendar/busytime/jsmith.ifb

END:VFREEBUSY

END:VCALENDAR


 

vCalendar 1.0

iCalendar's design was based on the previous file format vCalendar created by the Internet Mail Consortium (IMC).

Here is an example of information in vCalendar format:

BEGIN:VCALENDAR

VERSION:1.0

BEGIN:VEVENT

CATEGORIES:MEETING

STATUS:TENTATIVE

DTSTART:19960401T033000Z

DTEND:19960401T043000Z

SUMMARY:Your Proposal Review

DESCRIPTION:Steve and John to review newest proposal material

CLASS:PRIVATE

END:VEVENT

END:VCALENDAR


 

Sample PeopleCode for creating the ics file:


&descr = Substitute(&descr, Char(10), " ");

&descr = Substitute(&descr, Char(13), "");

/*build calendar file*/

Local string &strFileName;

&strFileName = %This.Validate_FileName(&ActivityCode);

&attachUserFile = &strFileName | "*.ics";

&fCal = GetFile(&attachUserFile, "N", %FilePath_Relative);

&attachSysFileName = &fCal.Name;

If &fCal.IsOpen Then

&fCal.WriteLine("BEGIN:VCALENDAR");

&fCal.WriteLine("PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//" | &str_lLanguageCode);

&fCal.WriteLine("VERSION:2.0");

&fCal.WriteLine("METHOD:PUBLISH");

&fCal.WriteLine("BEGIN:VEVENT");

&fCal.WriteLine("DTSTART:" | &strStartDT);

&fCal.WriteLine("DTEND:" | &strEndDT);

&fCal.WriteLine("LOCATION;ENCODING=QUOTED-PRINTABL E:" | &location);

&fCal.WriteLine("TRANSP:OPAQUE");

rem &fCal.WriteLine("SEQUENCE:0");

&fCal.WriteLine("UID:" | &UID);

&fCal.WriteLine("DTSTAMP:" | &strCurrDT);
/* this the code is which prints the description containing URL*/

&fCal.WriteLine("DESCRIPTION;ENCODING=QUOTED-PRINT ABLE:" | &descr);

&fCal.WriteLine("SUMMARY;ENCODING=QUOTED-PRINTABLE :" | &summary);

&fCal.WriteLine("PRIORITY:5");

rem &fCal.WriteLine("X-MICROSOFT-CDO-IMPORTANCE:1");

&fCal.WriteLine("CLASS:PUBLIC");

&fCal.WriteLine("END:VEVENT");

&fCal.WriteLine("END:VCALENDAR");

&fCal.Close();

End-If;

3 comments:

  1. great stuff ... its nice to read such interesting stuffs. Maybe will use it in future on any of my projects

    ReplyDelete
  2. In the new Peoplesoft releases, the invitations will be converted to ico files in outlook. So we can avoid the hurdle of writing the code

    ReplyDelete
  3. Nagyon erdekes, koszonom

    ReplyDelete