![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Dear All,
I developed an application to send meeting invitation using iCAL 2.0 protocol. The code is sent both in a proper body-section with ContentType("text/calendar") and as attachment (.ics). Once the receiver opens the email, the emai client evaluates such a body-section and displays all the data properly as a normal meeting request (showing the ACCEPT | TENTATIVE | DECLINE buttons). This works with: Gmail, Thunderbird and Outlook 2003. In Outlook 2007 the email is received as normal message. Only opening the ..ics attachment it then displays (in the attachment window) the buttons. How should I edit my code in order to be able to display directly the buttons in OE2007? Here the code for creating the iCAL invitation: string Content = ""; Content += "BEGIN:VCALENDAR\r\n"; Content += "PRODID:Microsoft CDO for Microsoft Exchange\r\n"; Content += "VERSION:2.0\r\n"; Content += "METHOD:REQUEST\r\n"; Content += "BEGIN:VEVENT\r\n"; Content += "ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:MAILTO:" + person.eMail + "\r\n"; Content += "ORGANIZER:MAILTO:" + Organizer.eMail + "\r\n"; Content += "DTSTART:" + this.GetDateTime(this.Start) + "\r\n"; //LOCAL TIME Content += "DTEND:" + this.GetDateTime(this.End) + "\r\n"; //LOCAL TIME Content += "LOCATION:" + this.Location + "\r\n"; Content += "DTSTAMP:" + this.GetDateTime(DateTime.Now) + "\r\n"; Content += "UID:" + this.UID + "\r\n"; Content += "CREATED: " + this.GetDateTime(DateTime.Now) + "\r\n"; Content += "SEQUENCE:0\r\n"; //Keeps track if the iCAL is modified Content += "LAST-MODIFIED: " + this.GetDateTime(DateTime.Now) + "\r\n"; Content += "PRIORITY:5\r\n"; Content += "X-MICROSOFT-CDO-TZID:11\r\n"; Content += "STATUS:CONFIRMED\r\n"; Content += "TRANSP:OPAQUE\r\n"; Content += "DESCRIPTION:" + this.Description.Replace("\r\n", "\\n") + "\r\n"; Content += "SUMMARY:" + this.Summary + "\r\n"; Content += "X-MICROSOFT-CDO-BUSYSTATUS:BUSY"; Content += "X-MICROSOFT-CDO-IMPORTANCE:1"; Content += "X-MICROSOFT-DISALLOW-COUNTER:TRUE"; Content += "X-MS-OLK-ALLOWEXTERNCHECK:TRUE"; Content += "X-MS-OLK-AUTOFILLLOCATION:TRUE"; Content += "X-MS-OLK-CONFTYPE:0"; Content += "X-MS-OLK-FORCEINSPECTOROPEN:TRUE\r\n"; Content += "BEGIN:VALARM\r\n"; Content += "ACTION ![]() Content += "DESCRIPTION:REMINDER\r\n"; Content += "TRIGGER:-PT15M\r\n"; Content += "END:VALARM\r\n"; Content += "END:VEVENT\r\n"; Content += "END:VCALENDAR\r\n"; And here the main part of the class sending the email: MailMessage message = new MailMessage(); string tempFilePath = ""; string Body = this.CreateBody(ToEMail); string Subject = this.CreateSubject(ToEMail); message.Sender = new MailAddress(this.FromEMail, ""); message.From = new MailAddress(this.ReplyEMail, this.FromName); message.To.Add(new MailAddress(ToEMail)); message.Body = Body; message.Subject = this.CreateSubject(ToEMail); message.IsBodyHtml = true; if (this._Calendar != null) { this.Calendar.Description = Body string attachmentCode = this.Calendar.GetICalendarText(); /*Setting content type */ ContentType calendarType = new ContentType("text/calendar"); calendarType.Parameters.Add("method", "REQUEST"); calendarType.CharSet = "utf-8"; int randNum = new Random().Next(100); string meetingFileName = "meetingInvitation"+randNum+".ics"; tempFilePath = HttpContext.Current.Server.MapPath(HttpContext.Cur rent.Request.ApplicationPath + "/Temp/" + meetingFileName); if (!string.IsNullOrEmpty(attachmentCode)) { StreamWriter tw = new StreamWriter(tempFilePath); tw.WriteLine(attachmentCode); tw.Dispose(); tw.Close(); if (File.Exists(tempFilePath)) { /*Creating the attachment*/ Attachment item = new Attachment(tempFilePath, MediaTypeNames.Application.Octet); item.TransferEncoding = TransferEncoding.SevenBit; calendarType.Parameters.Add("name", ""+meetingFileName+""); ContentDisposition disp = item.ContentDisposition; disp.CreationDate = System.IO.File.GetCreationTime(tempFilePath); disp.ModificationDate = System.IO.File.GetLastWriteTime(tempFilePath); disp.DispositionType = DispositionTypeNames.Attachment; message.Attachments.Add(item); } } /*Creating the alternative view for the meeting invitation*/ AlternateView calendarView = AlternateView.CreateAlternateViewFromString(attach mentCode, calendarType); message.AlternateViews.Add(calendarView); } smtp.Send(message); Thanks in advance for any suggestion. Regards, Francesco |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook Calendar accept/ decline | MrsRM | Outlook - Calandaring | 2 | December 10th 08 10:04 PM |
Accept/Decline Buttons Missing on Some Meetings | Jon[_3_] | Outlook - Calandaring | 0 | February 15th 08 04:36 PM |
HTML buttons in Outlook 2007 do not display, but they did in 2003 | zukowskig | Outlook - General Queries | 1 | October 31st 07 05:45 PM |
Meeting Requests - No Accept Decline or Tenative Buttons OL2002 | Nick | Outlook - Calandaring | 4 | August 3rd 06 01:17 AM |
Invitations not displaying accept/decline buttons | Swordsaint | Outlook - Calandaring | 1 | April 19th 06 06:27 PM |