function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
tolian02tolian02 

Sending Calendar Invitation Emails

I am trying to use the new email attachment methods in the winter '10 release to get emails sent from the appointment controller to be sent in an intuitively obvious way such that they will appear as calendar invitations when opened in Outlook, on a blackberry, in gmail, etc.

In the Winter '10: Platform Release Preview Webinar, Sarah Franklin said the following about new email features, "[If] you wanted to send emails that have a calendar attachment in them and have the person receiving the email open that up an go right into their outlook or something… Right now with Winter '10 we are announcing support for that."

If anyone knows how the Force folks were able to achieve this functionality with the new features please let me know.

Here is what I tried:

         Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
        email.setSubject(subjectLine);
        email.setToAddresses(toAddresses);
        email.setHtmlBody(AppointmentUtils.getNotificationBody(item.id));
        email.setPlainTextBody(AppointmentUtils.getNotificationBodyText(item.id));
            
        // Create an email attachment   
        Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
        efa.setFileName('Appointment.pdf'); // set name of PDF
        efa.setBody(AppointmentUtils.getNotificationPDF(item.id)); //attach the PDF
       

        Messaging.EmailFileAttachment vcal = new Messaging.EmailFileAttachment();
        vcal.setFileName('Appointment.ics');
        vcal.setBody(AppointmentUtils.getNotificationVCal(item.id));
        vcal.setContentType(mime);
            

        email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa, vcal});
        Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});  


Note this line: vcal.setContentType(mime);

I tried the following values for mime:

text/x-vCalendar

application/x-vCalendar

text/calendar

application/calendar

 

In all of these cases the calendar object showed up as an attachement rather than having the email itself be a calendar invitation.

sellis360sellis360

There must be a bug in this feature in Winter '10, because nobody seems to know how to make it work so that you can send an invitation out that can be accepted seemlessly in calendar/email applications like Outlook and Gmail/Google Calendar.  We'ev attempted to escalated it within Salesforce to no avail.  Similar discussion threads exist as well:

 


If anyone has any helpful information, please provide it!

 

Thanks.

tolian02tolian02

There has been no solution found to this yet. I am still waiting for the force developers to tell us how they did this. It would be great if they did since this is a major need of ours.

 

Other people have expressed similar sentiments:

 

http://community.salesforce.com/sforce/board/message?board.id=apex&thread.id=21211