Hi,
I would like to send a meeting request from peeoplecode.
I am aware of sending the .ics attachement in an email, but i would like to directly send as a meeting request instead of an attachement in email.
Let me know if there is any windows/unix command to send the meeting request by reading the parameters from the .ics file.
Thanks!!
| Title | Under | Posted on |
|---|---|---|
| how to create application status in peoplesoft campus solutions 8.9 version | PeopleSoft Functional | 05/17/2012 - 4:09am |
| horizantal text in charts | PeopleSoft Technical | 05/10/2012 - 4:57am |
| no current buffer context error | PeopleSoft Technical | 05/10/2012 - 1:19am |
| Integration Broker : Operating Instance/Pub Contracts/Sub Contracts | PeopleSoft Technical | 04/24/2012 - 11:05am |
I was able to get an outlook meeting request out of peoplecode using the PT_MCF_MAIL application package...
import PT_MCF_MAIL:*;
/*Declare variables*/
Local Record &cache = CreateRecord(Record.Z_CAL_CACHE);
Local string &guid;
Local string &url;
Local string &dateStr = DateTimeToLocalizedString(AUC_PLAN_TASKS.END_DT, "MM/dd/yyyy");
Local string &dateStamp = DateTimeToLocalizedString(%Datetime, "MM/dd/yyyy hh:mm:ss");
Local number &sequence_nbr;
Local string &plan_id = AUC_PLAN_HDR.AUC_PLAN_ID;
Local string &task_id = AUC_PLAN_TASKS.AUC_TASK_ID;
Local string &task_owner = AUC_PLAN_TASKS.TASK_OWNER;
Local string &mail_to;
Local string &organizer;
/*When user clicks send reminder button, determine if previous reminder was sent based on sequence number associated with Plan ID and Task #
in custom table. If sequence number is zero, this is the first reminder, so generate at GUID using RAWTOHEX. If sequence number is greater than 0, select
GUID from table. The GUID will be used in the Outlook formatted meeting request so that the existing event is correctly updated/moved in the
recipient's calendar. In either case, a new row will be inserted in to the CACHE table to track the sent meeting request.*/
SQLExec("SELECT MAX(SEQNBR) FROM PS_Z_CAL_CACHE WHERE AUC_PLAN_ID = :1 AND AUC_TASK_ID = :2", &plan_id, &task_id, &sequence_nbr);
If &sequence_nbr = 0 Then
SQLExec("SELECT RAWTOHEX(SYS_GUID()) FROM PS_INSTALLATION", &guid);
&sequence_nbr = 1;
Else
SQLExec("SELECT GUID FROM PS_Z_CAL_CACHE WHERE AUC_PLAN_ID = :1 AND AUC_TASK_ID = :2", &plan_id, &task_id, &guid);
&sequence_nbr = &sequence_nbr + 1;
End-If;
SQLExec("SELECT EMAILID FROM PSOPRDEFN WHERE oprid = :1", &task_owner, &mail_to);
SQLExec("SELECT A.EMAILID FROM PSOPRDEFN A, PS_AUC_PLAN_HDR B WHERE B.PLAN_OWNER = A.OPRID AND B.AUC_PLAN_ID =:1", &plan_id, &organizer);
rem MessageBox(0, "", 30000, 1, "Task Owner: " | &task_owner | ", Mail To: " | &mail_to);
/*Prepare data and insert into CACHE table and capture values for for Outlook reminder*/
&cache.GUID.Value = &guid;
&cache.SEQNBR.Value = &sequence_nbr;
&cache.START_DTTM.Value = DateTimeValue(&dateStr | " 12:00 PM");
&cache.END_DTTM.Value = DateTimeValue(&dateStr | " 12:00 PM");
&cache.DESCR.Value = "Task " | AUC_PLAN_TASKS.AUC_TASK_ID | " Due";
&cache.DESCR254.Value = "Task " | AUC_PLAN_TASKS.AUC_TASK_ID | " For Plan ID " | AUC_PLAN_HDR.AUC_PLAN_ID | " Is Due";
&cache.CATEGORY_DESCR.Value = "Bid/Contract Task Due";
&cache.AUC_PLAN_ID.Value = &plan_id;
&cache.AUC_TASK_ID.Value = &task_id;
&cache.DATETIME_DISPATCH.Value = DateTimeValue(&dateStamp);
&cache.Insert();
CommitWork();
/*Prepare date formats required for .ics format*/
&tempTime = DateTimeToTimeZone(&cache.START_DTTM.Value, "Local", "UTC");
&dtstart = DateTimeToLocalizedString(&tempTime, "yyyyMMdd'T'HHmmss'Z'");
&tempTime = DateTimeToTimeZone(&cache.END_DTTM.Value, "Local", "UTC");
&dtend = DateTimeToLocalizedString(&tempTime, "yyyyMMdd'T'HHmmss'Z'");
&tempTime = DateTimeToTimeZone(&cache.DATETIME_DISPATCH.Value, "Local", "UTC");
&dtstamp = DateTimeToLocalizedString(&tempTime, "yyyyMMdd'T'HHmmss'Z'");
Local string &CRLF = Char(13);
Local string &icalstring = "BEGIN:VCALENDAR" | &CRLF;
&icalstring = &icalstring | "PRODID:-//Microsoft Corporation//Outlook 12.0 MIMEDIR//EN" | &CRLF;
&icalstring = &icalstring | "VERSION:2.0" | &CRLF;
&icalstring = &icalstring | "METHOD:REQUEST" | &CRLF;
&icalstring = &icalstring | "BEGIN:VEVENT" | &CRLF;
&icalstring = &icalstring | "ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:" | &organizer | &CRLF;
&icalstring = &icalstring | "ORGANIZER:MAILTO:" | &organizer | &CRLF;
&icalstring = &icalstring | "DTSTART:" | &dtstart | &CRLF;
&icalstring = &icalstring | "DTEND:" | &dtend | &CRLF;
&icalstring = &icalstring | "LOCATION:Conference Room" | &CRLF;
&icalstring = &icalstring | "TRANSP:OPAQUE" | &CRLF;
&icalstring = &icalstring | "SEQUENCE:" | &sequence_nbr | &CRLF;
&icalstring = &icalstring | "UID:" | &guid | &CRLF;
&icalstring = &icalstring | "DTSTAMP:" | &dtstamp | &CRLF;
&icalstring = &icalstring | "CATEGORIES:Meeting" | &CRLF;
&icalstring = &icalstring | "DESCRIPTION:Reminder" | &CRLF;
&icalstring = &icalstring | "SUMMARY:" | &cache.DESCR.Value | &CRLF;
&icalstring = &icalstring | "PRIORITY:5" | &CRLF;
&icalstring = &icalstring | "BEGIN:VALARM" | &CRLF;
&icalstring = &icalstring | "TRIGGER:PT1440M" | &CRLF;
&icalstring = &icalstring | "ACTION:DISPLAY" | &CRLF;
&icalstring = &icalstring | "DESCRIPTION:Reminder" | &CRLF;
&icalstring = &icalstring | "END:VALARM" | &CRLF;
&icalstring = &icalstring | "END:VEVENT" | &CRLF;
&icalstring = &icalstring | "END:VCALENDAR";
/*Format multi-part email and send*/
Local PT_MCF_MAIL:MCFOutboundEmail &email = create PT_MCF_MAIL:MCFOutboundEmail();
&email.From = &organizer;
&email.Recipients = &mail_to;
&email.Subject = "Task Reminder " | &cache.DESCR254.Value;
&email.AddHeader("", "method=REQUEST");
&email.AddHeader("", "charset=UTF-8");
&email.AddHeader("", "component=VEVENT");
&email.ContentType = "multipart/alternative";
Local PT_MCF_MAIL:MCFBodyPart &text = create PT_MCF_MAIL:MCFBodyPart();
&text.Text = "Part 1: Email Text";
&text.ContentType = "text/html";
Local PT_MCF_MAIL:MCFBodyPart &iCal = create PT_MCF_MAIL:MCFBodyPart();
&iCal.Text = &icalstring;
&iCal.AddHeader("content-class", "urn:content-classes:calendarmessage");
&iCal.AddHeader("content-ID", "calendar_message");
&iCal.ContentType = "text/calendar;method=REQUEST; charset=UTF-8";
Local PT_MCF_MAIL:MCFMultipart &mp = create PT_MCF_MAIL:MCFMultipart();
&mp.SubType = "alternative; differences=Content-type";
&mp.AddBodyPart(&text);
&mp.AddBodyPart(&iCal);
&email.MultiPart = ∓
Local integer &resp = &email.Send();
Local boolean &done;
Evaluate &resp
When %ObEmail_Delivered
/* every thing ok */
&done = True;
Break;
When %ObEmail_NotDelivered
/*-- Check &email.InvalidAddresses, &email.ValidSentAddresses
and &email.ValidUnsentAddresses */
&done = False;
Break;
When %ObEmail_PartiallyDelivered
/* Check &email.InvalidAddresses, &email.ValidSentAddresses
and &email.ValidUnsentAddresses; */
&done = True;
Break;
When %ObEmail_FailedBeforeSending
/* Get the Message Set Number, message number;
Or just get the formatted messages from &email.ErrorDescription,
&email.ErrorDetails;*/
&done = False;
MessageBox(0, "", 30000, 1, "Failed Before Sending" | "Error Description: " | &email.ErrorDescription | "Error Detail: " | &email.ErrorDetails);
Break;
End-Evaluate;
Nate, thanks for sharing your work with us. I will be taking your code and post it as a blog entry sometime this week so it gets more esposure.
Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog
Great. I'm still tweaking some elements on it, but it's a starting point (the TRIGGER element is still a fixed value, etc.). The main issue was getting the format of the email and iCal content in a format that Outlook would interpret correctly. This worked on Outlook 2007, different versions may require different elements included in the &icalstring content. Also planning to create a 'cancel' component to remove an event as well.
Hi,
When i try to run the above code, i have got the below error.
nested exception is:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/calendar;method=REQUEST; charset=UTF-8.\nStack Trace:\njavax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/calendar;method=REQUEST; charset=UTF-8
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:421)
at com.peoplesoft.pt.mcf.mail.MCFOutboundEmail.send(MCFOutboundEmail.java:657)
at com.peoplesoft.pt.mcf.mail.MCFOutboundEmail.send(MCFOutboundEmail.java:825)
Failed Before SendingError Description: JavaMail Exception: javax.mail.MessagingException, Message: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/calendar;method=REQUEST; charset=UTF-8.Error Detail: JavaMail Error: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/calendar;method=REQUEST; charset=UTF-8.\nStack Trace:\njavax. (30000,1)
Please let me know how to resolve this issue.
Thank you
The above code was deployed on PT 8.50.11 and using javax.mail_1.4 -- you may want to confirm your version of the java package.
Yes Please,
Could you please lemme know how to resolve this error.
I am using
PT 8.48
and PIA 9.0
Thanks
Vamshi
I'm not a java person, I would look at the threads below. Like I was saying, you may have an issue in the java mail jar files in your ps home.
http://www.thatsjava.com/java-enterprise/41196/
http://www.jguru.com/faq/view.jsp?EID=237257
Post new comment