I have a working code that sends an invitation to an event for Outlook. It works fine but it is sent as an attachment and what I need is for the invitation to appear in the body of the email (just like it would if you sent it directly from Outlook). I'm pretty sure I'm just missing a little something that will do the trick, but I'm afraid I haven't been able to figure it out myself. In my research I found some posts mentioning an "AlternateView" but I couldn't integrate it in my Groovy code:
import de.uplanet.util.ISODateTimeUtil
def strFileName = "Event"
def guidAppointment = g_record["D37C04FDBED8A152DCB4C120DB82EF816E0EAB36"].value
def strSummary = g_record["D478BD0B2931FD34E9459714303B0C6EAFE80CCA"].value
def strLocation = g_record["02F2D4D9952105630C41389D9D3E21251DE11597"].value
def strDescription = g_record["88FB2A9CAF36FF33E4E9CDB4521CD1B63D25AC36"].value
def tsStart = g_record["EEA3581F8BF1152C15E4C11B8FBE32E8B328B0E0"].value
def tsEnd = g_record["758531F29CEA8713BC51BB167458CFBB287BB02F"].value
def tsStamp = now().withoutFractionalSeconds
def isoUtil = ISODateTimeUtil.newInstance()
def strStart = isoUtil.formatISODateTime(tsStart)
def strEnd = isoUtil.formatISODateTime(tsEnd)
def strStamp = isoUtil.formatISODateTime(tsStamp)
import de.uplanet.lucy.server.mail.GroovyMailBuilder
def mail = new GroovyMailBuilder().composeMail {
headers = [
"Importance": "Normal",
"X-Priority": "1",
"Content-Class": "urn:content-classes:calendarmessage",
"Method": "REQUEST"
]
from = "organizer@company.com"
to = "attendee@company.com"
subject = "testing ics"
contentType = "text/calendar; charset=UTF-8"
body << """
BEGIN:VCALENDAR
PRODID:-//testing
VERSION:2.0
METHOD:REQUEST
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VEVENT
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN="Attendee":MAILTO:attendee@company.com
ORGANIZER;CN="Organizer":organizer@company.com
ACTION;RSVP=TRUE;CN="Organizer":MAILTO:organizer@company.com
CLASS:PUBLIC
UID:${guidAppointment}
SUMMARY:${strSummary}
DESCRIPTION:${strDescription}
DTEND:${strEnd}
DTSTAMP:${strStamp}
DTSTART:${strStart}
LAST-MODIFIED:${strStamp}
LOCATION:${strLocation}
PRIORITY:5
SEQUENCE:0
TRANSP:OPAQUE
X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE
X-MICROSOFT-CDO-IMPORTANCE:1
X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
X-MICROSOFT-DISALLOW-COUNTER:FALSE
X-MS-OLK-ALLOWEXTERNCHECK:TRUE
X-MS-OLK-AUTOSTARTCHECK:FALSE
X-MS-OLK-CONFTYPE:0
X-MS-OLK-SENDER;CN="Organizer":MAILTO:organizer@company.com
BEGIN:VALARM
TRIGGER:-PT15M
ACTION:DISPLAY
DESCRIPTION:Reminder
END:VALARM
END:VEVENT
END:VCALENDAR
"""
}
mail.drop()
Has anyone an idea? Thanks a lot in advance!