title: Outlook Email and ICS format -- Strange behavior
body: <p>To begin, I will set the scenario.  I am using the biweekly library to create a VEvent and an ICalendar.  Everything is working fine (code below).  I can <strong>successfully send a calendar invite to Google</strong> and the appropriate 'Accept, Decline, Add to Calendar' options are available. </p>
  
  <p>When I send the same message to Outlook, I do not receive the correct invite. The message is formatted in such a way that it expects the recipient to send the invite - not be invited, nor add to his/her calendar.   </p>
  
  <p>The framework:</p>
  
  <p>Java
   - JavaMailSender
   - Spring Boot
   - biweekly</p>
  
  <p>The code is operational.  The issue in is the difference in which Outlook handles the calendar invite.</p>
  
  <p><strong>Here is the Java code...</strong></p>
  
  <pre><code>@Service
  public class CalendarEvent {
  
  private JavaMailSender javaMailSender;
  
  @Autowired
  public CalendarEvent(JavaMailSender javaMailSender) {
      this.javaMailSender = javaMailSender;
  }
  
  public void createCal() throws MessagingException, ParseException, IOException {
  
      ICalendar ical = new ICalendar();
  
      VEvent event = new VEvent();
  
      Attendee attendee = new Attendee("Juniper", "blank@blank.com");
      attendee.setRsvp(true);
      attendee.setRole(Role.ATTENDEE);
      attendee.setParticipationStatus(ParticipationStatus.NEEDS_ACTION);
      attendee.setParticipationLevel(ParticipationLevel.REQUIRED);
  
      event.addAttendee(attendee);
  
      event.setSummary("hello");
  
      DateTime dt = new DateTime(2016, 12, 28, 12, 0);
      DateTime et = new DateTime(2016, 12, 28, 13, 30);
      Date starts = (Date) dt.toDate();
      Date ends = (Date) et.toDate();
  
      DateStart thisStart = new DateStart(starts, true);
      DateEnd dateEnd = new DateEnd(ends, true);
  
      event.setDateStart(thisStart);
      event.setDateEnd(dateEnd);
  
      Duration reminder = new Duration.Builder().minutes(15).build();
      Trigger trigger = new Trigger(reminder, Related.START);
      Action action = new Action("DISPLAY");
      VAlarm valarm = new VAlarm(action, trigger);
      event.addAlarm(valarm);
  
      Duration duration = new Duration.Builder().hours(1).build();
      event.setDuration(duration);
  
      event.setUid("555xxx");
      event.setOrganizer("blank@blank.com");
      event.setLocation("Small");
  
      ical.addEvent(event);
  
      String str = Biweekly.write(ical).go();
  
      MimeMessage message = javaMailSender.createMimeMessage();
      message.addHeaderLine("charset=UTF-8");
      message.addHeaderLine("component=VEVENT");
      message.addHeaderLine("method=REQUEST");
  
      message.setFrom("blank@blank.com");
      message.addRecipient(Message.RecipientType.TO, new InternetAddress("blank@blank.com"));
      message.setSubject("You're Invited to a Meeting");
  
      // Create the message part
      BodyPart messageBodyPart = new MimeBodyPart();
  
      // Fill the message
      messageBodyPart.setHeader("Content-Class", "urn:content-classes:calendarmessage");
      messageBodyPart.setHeader("Content-ID", "calendar_message");
      messageBodyPart.setDataHandler(new DataHandler(new ByteArrayDataSource(str, "text/calendar")));// very important
  
  
      Multipart multipart = new MimeMultipart();
  
  
      multipart.addBodyPart(messageBodyPart);
  
  
      message.setContent(multipart);
  
      javaMailSender.send(message);
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p><strong>Here is the ICS...</strong></p>
  
  <pre><code>BEGIN:VCALENDAR
  VERSION:2.0
  PRODID:-//Michael Angstadt//biweekly 0.6.0//EN BEGIN:VEVENT 
  DTSTAMP:20161223T203840Z ATTENDEE;RSVP=TRUE;ROLE=REQ-  
  PARTICIPANT;PARTSTAT=NEEDS-ACTION;CN=Juniper:mail
   to:blank@blank.com
  SUMMARY:hello
  DTSTART:20161228T170000Z
  DTEND:20161228T183000Z
  DURATION:PT1H
  UID:555****
  ORGANIZER:mailto:blank@blank.com
  LOCATION:Small
  BEGIN:VALARM
  ACTION:DISPLAY
  TRIGGER;RELATED=START:PT15M
  END:VALARM
  END:VEVENT
  END:VCALENDAR
  </code></pre>
  
  <p><strong>Here is the Opened Outlook Email (notice how it is a composed message)...</strong></p>
  
  <p><a href="https://i.stack.imgur.com/4Lw5F.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4Lw5F.jpg" alt="enter image description here"></a></p>
  
  <p><strong>Here is the Opened Gmail Email...</strong></p>
  
  <p><a href="https://i.stack.imgur.com/Gfffq.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Gfffq.jpg" alt="enter image description here"></a></p>
  
  <p>I have found the documentation to be limited and was hoping somebody may have/is encountered/ecountering the same issue.  Thanks for reading.</p>