title: Using X-ALT-DESC / Applying HTML to calendar invites in Outlook
body: <p>I'm a beginner in C# (and any networking code to be honest).  I'm trying to send a calendar invite, that will be wired when you click a button on the company's website.  This is a typical n-tier system, using asp.net/C# and SQL.  </p>
  
  <p>We used to simply generate an ics that the user would then have to know to open with Outlook, but I've since learned how to manually code a VCALENDAR so it shows up right away in Outlook nice and neat.</p>
  
  <p>It's all been going fairly smoothly, but I would now like the body of the calendar invite to be able to accept HTML, to attach links in particular.  I've experimented with AlternateViews, but it seems that the "X-ALT-DESC" attribute inside of VCALENDAR should do exactly what I want.  However, try as I may Outlook ignores it and uses the description.  There is clearly something I am missing.</p>
  
  <p>(To clarify, everything works &amp; compiles, except for the HTML alt description)</p>
  
  <pre><code>private Guid? CreateEmail()
  {
  
          Guid eventGuid = Guid.NewGuid();
  
          MailMessage msg = new MailMessage();
          msg.IsBodyHtml = true;
          msg.From = new MailAddress("fromemail", "From Name");
          msg.To.Add(toEmail);
          msg.Subject = subject;
  
          StringBuilder s = new StringBuilder();
          s.AppendLine("BEGIN:VCALENDAR");
          s.AppendLine("VERSION:2.0");
          s.AppendLine("PRODID:-//My Product//Outlook MIMEDIR//EN");
          s.AppendLine("METHOD:" + method); //In this case, "REQUEST"
          s.AppendLine("STATUS:" + status.status);  //"CONFIRMED"
          s.AppendLine("BEGIN:VEVENT");
          s.AppendLine("UID:" + eventGuid.ToString()); 
          s.AppendLine("PRIORITY" + status.priority); //3
          s.AppendLine("X-MICROSOFT-CDO-BUSYSTATUS:" + ShowAs.ToString()); //"BUSY"
          s.AppendLine("SEQUENCE:" + UpdateNumber);//0
          s.AppendLine("DTSTAMP:" + DateTime.Now.ToUniversalTime().ToString());
          s.AppendLine("DTSTART:" + DateTimetoCalTime(startTime));  
          s.AppendLine("DTEND:" + DateTimetoCalTime(endTime));
          s.AppendLine("SUMMARY:" + subject);
          s.AppendLine("LOCATION: " + location);
          s.AppendLine("DESCRIPTION: " + "Plain simple description"
  
   string html_begin = "&lt;!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\"&gt;" +
              "\n&lt;html&gt;" +
              "\n&lt;head&gt;" +
              "\n&lt;title&gt;&lt;/title&gt;" +
              "\n&lt;/head&gt;" +
              "\n&lt;body&gt;" +
              "\n&lt;!-- Converted from text/rtf format --&gt;\n\n&lt;P DIR=LTR&gt;&lt;SPAN LANG=\"en-us\"&gt;" +
              "\n&lt;Font face=\"Times New Roman\"";
  
          body = "I simply &lt;b&gt; want some bold &lt;/b&gt; here 555";
  
          string html_end = "&lt;/font&gt;&lt;/span&gt;&lt;/body&gt;\n&lt;/html&gt;";
          string html_body = html_begin + body + html_end;
  
          msg.Body = html_body;
          s.AppendLine("X-ALT-DESC;FMTTYPE=text/html:" + html_body);
  
          msg.Body = html_body;
          s.AppendLine("X-ALT_DESC;FMTTYPE=text/html:" + html_body);
  
          s.AppendLine("STATUS:" + status.status); //"CONFIRMED"
          s.AppendLine("BEGIN:VALARM");
          s.AppendLine("TRIGGER:-PT1440M");
          s.AppendLine("ACTION:Accept");
          s.AppendLine("DESCRIPTION:Reminder");
          s.AppendLine("END:VALARM");
  
          s.AppendLine("END:VEVENT");
  
          s.AppendLine(string.Format("ATTENDEE;CN=\"{0}\";RSVP=TRUE:mailto:{1}", msg.To[0].DisplayName, msg.To[0].Address));
          s.AppendLine("END:VCALENDAR");
  
          System.Net.Mime.ContentType type = new System.Net.Mime.ContentType("text/calendar");
          type.Parameters.Add("method", method);
          type.Parameters.Add("name", "meeting.ics");
          msg.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(s.ToString(), type));
  
  SMTP.send(msg);
  return EventGuid;
  </code></pre>
  
  <p>Produces this body in outlook:</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 3.2//EN”&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;!-- Converted from text/rtf format --&gt;
  
  &lt;P DIR=LTR&gt;&lt;SPAN LANG=”en-us”&gt;
  &lt;Font face=”Times New Roman”I simply &lt;b&gt; want some bold &lt;/b&gt; here 555&lt;/font&gt;&lt;/span&gt;&lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>From testing:
  If I leave Msg.body out, it just used the "DESCRIPTION".
  If I make it equal the HTML, I get the above result.</p>
  
  <p>Thank You!</p>