title: C# iCal Invite Not Showing Up Right in Outlook
body: <p>I have a client that cannot see the same format of the emails I have.  I am on Outlook 2007 and they are on a mix of 2003, 2007, and 2010.  The invite shows up fine for me, but all they see is a normal email and all of the HTML markup shows, instead of the email being formatted.</p>
  
  <p>Here is what I have right now:</p>
  
  <pre><code>    protected void SendMessage(MailMessage message, bool cancel)
      {
          AlternateView av = GetInviteContent(cancel);
          message.AlternateViews.Add(av);
  
          base.SendMessage(message);
      }
  
      private AlternateView GetInviteContent(bool cancel)
      {
          StringBuilder str = new StringBuilder();
          str.AppendLine("BEGIN:VCALENDAR");
          str.AppendLine("VERSION:2.0");
          if(cancel)
              str.AppendLine("METHOD:CANCEL");
          else
              str.AppendLine("METHOD:REQUEST");
          str.AppendLine("BEGIN:VEVENT");
          if(cancel)
              str.AppendLine("STATUS:CANCELLED");
          str.AppendLine(string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}", StartTime));
          str.AppendLine(string.Format("DTEND:{0:yyyyMMddTHHmmssZ}", EndTime));
          str.AppendLine(string.Format("LOCATION:{0}", Location));
          str.AppendLine(string.Format("UID:{0}", Guid.NewGuid()));
          str.AppendLine(string.Format("DESCRIPTION:{0}", Body));
          str.AppendLine(string.Format("X-ALT-DESC;FMTTYPE=text/html:{0}", Body));
          str.AppendLine(string.Format("SUMMARY:{0}", Subject));
          str.AppendLine(string.Format("ORGANIZER;CN={0}:MAILTO:{1}", From.Email, From.FormalName));
  
          foreach (var to in To)
          {
              str.AppendLine(string.Format("ATTENDEE;CN={0};ROLE=REQ-PARTICIPANT:MAILTO:{1}", to.FormalName, to.Email));
          }
  
          str.AppendLine("BEGIN:VALARM");
          str.AppendLine(string.Format("TRIGGER:-PT{0}M", Reminder.Minutes));
          str.AppendLine("ACTION:DISPLAY");
          str.AppendLine("DESCRIPTION:Reminder");
          str.AppendLine("END:VALARM");
          str.AppendLine("END:VEVENT");
          str.AppendLine("END:VCALENDAR");
          System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType("text/calendar");
          if(cancel)
              ct.Parameters.Add("method", "CANCEL");
          else
              ct.Parameters.Add("method", "REQUEST");
          return AlternateView.CreateAlternateViewFromString(str.ToString(), ct);
      }
  </code></pre>