events created with python vobject are not recognised by ms exchange
Question: I create an meeting invite using the python vobject and django's
`EmailMultiAlternatives` as follows:

    
    
    cal = vobject.iCalendar()
    cal.add('method').value = 'REQUEST' #IE/Outlook needs this
    vevent = cal.add('vevent')
    start = datetime.datetime(start.year, start.month, start.day, start.hour, start.minute, 0, 0, gettz(timezone))
    end = datetime.datetime(end.year, end.month, end.day, end.hour, end.minute, 0, 0, gettz(timezone))
    vevent.add('dtstamp').value = datetime.datetime.utcnow()
    vevent.add('organizer').value = "mailto:" + organizer.email
    vevent.add('uid').value = uid
    vevent.add('sequence').value = str(sequence_number)
    for participant in participants:
        vevent.add('attendee;cutype=individual;role=req-participant;partstat=needs-action;rsvp=true').value = "mailto:" + participant.email
    vevent.add('dtstart').value = start
    vevent.add('dtend').value = end
    vevent.add('summary').value = title
    vevent.add('description').value = desc
    vevent.add('last-modified').value = datetime.datetime.utcnow()
    vevent.add('status').value = 'CONFIRMED'
    vevent.add('location').value = ''
    vevent.add('priority').value = '5'
    vevent.add('class').value = ''
    vevent.add('transp').value = 'OPAQUE'
    vevent.add('created').value = created
    vevent.add('x-microsoft-cdo-busystatus').value = 'BUSY'
    vevent.add('x-microsoft-cdo-alldayevent').value = 'FALSE'
    vevent.add('x-microsoft-cdo-insttype').value = '0'
    vevent.add('x-microsoft-cdo-intendedstatus').value = 'FALSE'
    vevent.add('x-microsoft-cdo-importance').value = '1'
    vevent.add('x-microsoft-cdo-appt-sequence').value = str(sequence_number)
    

The email sent is as follows:

    
    
    Content-Type: multipart/mixed; boundary="===============0735652256227437116=="
    MIME-Version: 1.0
    Subject: Test Meeting
    From: "..." <...@example.com>
    To: ...@example.com
    Date: Tue, 21 Jun 2011 13:31:43 -0000
    Message-ID: <20110621133143.17903.84489@...>
    Reply-To: "..." <...@example.com>
    X-OriginalArrivalTime: 21 Jun 2011 13:29:25.0546 (UTC) FILETIME=[3D2A38A0:01CC3017]
    
    --===============0735652256227437116==
    Content-Type: multipart/alternative;
        boundary="===============1854598015118304554=="
    MIME-Version: 1.0
    
    --===============1854598015118304554==
    Content-Type: text/plain; charset="utf-8"
    MIME-Version: 1.0
    Content-Transfer-Encoding: quoted-printable
    
    Subject: Test Meeting
    Time: 8 p.m. - 9 p.m. GMT+0530 Asia/Kolkata
    Moderator: ... (...@example.com)
    Message: A test meeting.
    --===============1854598015118304554==
    Content-Type: text/html; charset="utf-8"
    MIME-Version: 1.0
    Content-Transfer-Encoding: quoted-printable
    
            <table width=3D"100%">
                <tr bgcolor=3D"#d8d8d8">
                    <td align=3D"center">
                        <table width=3D"530px" bgcolor=3D"#FFFFFF" style=3D"ma=
    rgin-top:20px;padding:10px;margin-bottom:20px;text-align:left;">
                            <tr>
                                <td  style=3D"padding-top:10px;">
                                    <font face=3D"Arial, Helvetica, sans-serif=
    ">
                                        <font color=3D"#336699" size=3D"14px" =
    style=3D"font-size:14px;line-height:18px;"><b>Meeting Title:</b></font>
                                        <font size=3D"14px" style=3D"font-size=
    :14px;">Test&nbsp;Meeting</font>
                                    </font>
                                </td>
                            </tr>
                            <tr>
                                <td  style=3D"padding-top:10px;">
                                    <font face=3D"Arial, Helvetica, sans-serif=
    ">
                                        <font color=3D"#336699" size=3D"14px" =
    style=3D"font-size:14px;line-height:18px;"><b>Meeting Time:</b></font>
    
                                        <font size=3D"14px" style=3D"font-size=
    :14px;">June 21, 2011</font>
                                        <font size=3D"14px" style=3D"font-size=
    :14px;">8 p.m. - 9 p.m.</font>
    
                                        <font size=3D"11px" style=3D"font-size=
    :11px;">GMT+0530 Asia/Kolkata</font>
                                    </font>
                                </td>
                            </tr>
                            <tr>
                                <td style=3D"padding-top:10px;">
                                    <font face=3D"Arial, Helvetica, sans-serif=
    ">
                                        <font size=3D"14px" color=3D"#336699" =
    style=3D"font-size:14px;line-height:18px;"><b>Moderator:</b></font>
                                        <font size=3D"14px" style=3D"font-size=
    :14px;">...</font>
                                        <font size=3D"14px" style=3D"font-size=
    :14px;">(<a href=3D"mailto:...@example.com">...@example.com</a>)</font>
                                    </font>
                                </td>
                            </tr>
    
                            <tr>
                                <td style=3D"padding-top:10px;">
                                    <font face=3D"Arial, Helvetica, sans-serif=
    ">
                                        <font size=3D"14px" color=3D"#336699" =
    style=3D"font-size:14px;line-height:18px;"><b>Message/Description:</b></fon=
    t><br>
                                        <font size=3D"14px" style=3D"font-size=
    :14px;">A&nbsp;test&nbsp;meeting.<br /></font>
                                    </font>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
    --===============1854598015118304554==
    MIME-Version: 1.0
    Content-Type: text/calendar; method="REQUEST"; name="invite.ics";
        charset="utf-8"
    Content-Transfer-Encoding: quoted-printable
    Content-class: urn:content-classes:calendarmessage
    
    BEGIN:VCALENDAR
    VERSION:2.0
    METHOD:REQUEST
    PRODID:-//PYVOBJECT//NONSGML Version 1//EN
    BEGIN:VTIMEZONE
    TZID:IST
    BEGIN:STANDARD
    DTSTART:20000101T000000
    RRULE:FREQ=3DYEARLY;BYMONTH=3D1
    TZNAME:IST
    TZOFFSETFROM:+0530
    TZOFFSETTO:+0530
    END:STANDARD
    END:VTIMEZONE
    BEGIN:VEVENT
    UID:IoCJJ_840167408_31@example.com
    DTSTART;TZID=3DIST:20110621T200000
    DTEND;TZID=3DIST:20110621T210000
    ATTENDEE;CUTYPE=3DINDIVIDUAL;ROLE=3DREQ-PARTICIPANT;PARTSTAT=3DNEEDS-ACTIO=
    N;RSVP
     =3DTRUE:mailto:...@example.com
    CLASS:
    CREATED:20110621T052344Z
    DESCRIPTION:A test meeting.\n
    DTSTAMP:20110621T133143Z
    LAST-MODIFIED:20110621T133143Z
    LOCATION:
    ORGANIZER:mailto:...@example.com
    PRIORITY:5
    SEQUENCE:1
    STATUS:CONFIRMED
    SUMMARY:Test Meeting
    TRANSP:OPAQUE
    X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
    X-MICROSOFT-CDO-APPT-SEQUENCE:1
    X-MICROSOFT-CDO-BUSYSTATUS:BUSY
    X-MICROSOFT-CDO-IMPORTANCE:1
    X-MICROSOFT-CDO-INSTTYPE:0
    X-MICROSOFT-CDO-INTENDEDSTATUS:FALSE
    END:VEVENT
    END:VCALENDAR
    --===============1854598015118304554==--
    --===============0735652256227437116==
    Content-Type: application/ics; name="invite.ics"
    MIME-Version: 1.0
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment; filename="invite.ics"
    
    QkVHSU46VkNBTEVOREFSDQpWRVJTSU9OOjIuMA0KTUVUSE9EOlJFUVVFU1QNClBST0RJRDotLy9QWVZPQkpFQ1QvL05PTlNHTUwgVmVyc2lvbiAxLy9FTg0KQkVHSU46VlRJTUVaT05FDQpUWklEOklTVA0KQkVHSU46U1RBTkRBUkQNCkRUU1RBUlQ6MjAwMDAxMDFUMDAwMDAwDQpSUlVMRTpGUkVRPVlFQVJMWTtCWU1PTlRIPTENClRaTkFNRTpJU1QNClRaT0ZGU0VURlJPTTorMDUzMA0KVFpPRkZTRVRUTzorMDUzMA0KRU5EOlNUQU5EQVJEDQpFTkQ6VlRJTUVaT05FDQpCRUdJTjpWRVZFTlQNClVJRDpJb0NKSl84NDAxNjc0MDhfMzFAZXhhbXBsZS5jb20NCkRUU1RBUlQ7VFpJRD1JU1Q6MjAxMTA2MjFUMjAwMDAwDQpEVEVORDtUWklEPUlTVDoyMDExMDYyMVQyMTAwMDANCkFUVEVOREVFO0NVVFlQRT1JTkRJVklEVUFMO1JPTEU9UkVRLVBBUlRJQ0lQQU5UO1BBUlRTVEFUPU5FRURTLUFDVElPTjtSU1ZQDQogPVRSVUU6bWFpbHRvOi4uLkBleGFtcGxlLmNvbQ0KQ0xBU1M6DQpDUkVBVEVEOjIwMTEwNjIxVDA1MjM0NFoNCkRFU0NSSVBUSU9OOkEgdGVzdCBtZWV0aW5nLlxuDQpEVFNUQU1QOjIwMTEwNjIxVDEzMzE0M1oNCkxBU1QtTU9ESUZJRUQ6MjAxMTA2MjFUMTMzMTQzWg0KTE9DQVRJT046DQpPUkdBTklaRVI6bWFpbHRvOi4uLkBleGFtcGxlLmNvbQ0KUFJJT1JJVFk6NQ0KU0VRVUVOQ0U6MQ0KU1RBVFVTOkNPTkZJUk1FRA0KU1VNTUFSWTpUZXN0IE1lZXRpbmcNClRSQU5TUDpPUEFRVUUNClgtTUlDUk9TT0ZULUNETy1BTExEQVlFVkVOVDpGQUxTRQ0KWC1NSUNST1NPRlQtQ0RPLUFQUFQtU0VRVUVOQ0U6MQ0KWC1NSUNST1NPRlQtQ0RPLUJVU1lTVEFUVVM6QlVTWQ0KWC1NSUNST1NPRlQtQ0RPLUlNUE9SVEFOQ0U6MQ0KWC1NSUNST1NPRlQtQ0RPLUlOU1RUWVBFOjANClgtTUlDUk9TT0ZULUNETy1JTlRFTkRFRFNUQVRVUzpGQUxTRQ0KRU5EOlZFVkVOVA0KRU5EOlZDQUxFTkRBUg==
    --===============0735652256227437116==--
    

Which when decoded looks like:

    
    
    Content-Type: multipart/mixed; boundary="===============0735652256227437116=="
    MIME-Version: 1.0
    Subject: Test Meeting
    From: "..." <...@example.com>
    To: ...@example.com
    Date: Tue, 21 Jun 2011 13:31:43 -0000
    Message-ID: <20110621133143.17903.84489@...>
    Reply-To: "..." <...@example.com>
    X-OriginalArrivalTime: 21 Jun 2011 13:29:25.0546 (UTC) FILETIME=[3D2A38A0:01CC3017]
    
    --===============0735652256227437116==
    Content-Type: multipart/alternative;
        boundary="===============1854598015118304554=="
    MIME-Version: 1.0
    
    --===============1854598015118304554==
    Content-Type: text/plain; charset="utf-8"
    MIME-Version: 1.0
    Content-Transfer-Encoding: quoted-printable
    
    Subject: Test Meeting
    Time: 8 p.m. - 9 p.m. GMT+0530 Asia/Kolkata
    Moderator: ... (...@example.com)
    Message: A test meeting.
    --===============1854598015118304554==
    Content-Type: text/html; charset="utf-8"
    MIME-Version: 1.0
    Content-Transfer-Encoding: quoted-printable
    
            <table width="100%">
                <tr bgcolor="#d8d8d8">
                    <td align="center">
                        <table width="530px" bgcolor="#FFFFFF" style="margin-top:20px;padding:10px;margin-bottom:20px;text-align:left;">
                            <tr>
                                <td  style="padding-top:10px;">
                                    <font face="Arial, Helvetica, sans-serif">
                                        <font color="#336699" size="14px" style="font-size:14px;line-height:18px;"><b>Meeting Title:</b></font>
                                        <font size="14px" style="font-size:14px;">Test&nbsp;Meeting</font>
                                    </font>
                                </td>
                            </tr>
                            <tr>
                                <td  style="padding-top:10px;">
                                    <font face="Arial, Helvetica, sans-serif">
                                        <font color="#336699" size="14px" style="font-size:14px;line-height:18px;"><b>Meeting Time:</b></font>
    
                                        <font size="14px" style="font-size:14px;">June 21, 2011</font>
                                        <font size="14px" style="font-size:14px;">8 p.m. - 9 p.m.</font>
    
                                        <font size="11px" style="font-size:11px;">GMT+0530 Asia/Kolkata</font>
                                    </font>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding-top:10px;">
                                    <font face="Arial, Helvetica, sans-serif">
                                        <font size="14px" color="#336699" style="font-size:14px;line-height:18px;"><b>Moderator:</b></font>
                                        <font size="14px" style="font-size:14px;">...</font>
                                        <font size="14px" style="font-size:14px;">(<a href="mailto:...@example.com">...@example.com</a>)</font>
                                    </font>
                                </td>
                            </tr>
    
                            <tr>
                                <td style="padding-top:10px;">
                                    <font face="Arial, Helvetica, sans-serif">
                                        <font size="14px" color="#336699" style="font-size:14px;line-height:18px;"><b>Message/Description:</b></font><br>
                                        <font size="14px" style="font-size:14px;">A&nbsp;test&nbsp;meeting.<br /></font>
                                    </font>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
    --===============1854598015118304554==
    MIME-Version: 1.0
    Content-Type: text/calendar; method="REQUEST"; name="invite.ics";
        charset="utf-8"
    Content-Transfer-Encoding: quoted-printable
    Content-class: urn:content-classes:calendarmessage
    
    BEGIN:VCALENDAR
    VERSION:2.0
    METHOD:REQUEST
    PRODID:-//PYVOBJECT//NONSGML Version 1//EN
    BEGIN:VTIMEZONE
    TZID:IST
    BEGIN:STANDARD
    DTSTART:20000101T000000
    RRULE:FREQ=YEARLY;BYMONTH=1
    TZNAME:IST
    TZOFFSETFROM:+0530
    TZOFFSETTO:+0530
    END:STANDARD
    END:VTIMEZONE
    BEGIN:VEVENT
    UID:IoCJJ_840167408_31@example.com
    DTSTART;TZID=IST:20110621T200000
    DTEND;TZID=IST:20110621T210000
    ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP
     =TRUE:mailto:...@example.com
    CLASS:
    CREATED:20110621T052344Z
    DESCRIPTION:A test meeting.\n
    DTSTAMP:20110621T133143Z
    LAST-MODIFIED:20110621T133143Z
    LOCATION:
    ORGANIZER:mailto:...@example.com
    PRIORITY:5
    SEQUENCE:1
    STATUS:CONFIRMED
    SUMMARY:Test Meeting
    TRANSP:OPAQUE
    X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
    X-MICROSOFT-CDO-APPT-SEQUENCE:1
    X-MICROSOFT-CDO-BUSYSTATUS:BUSY
    X-MICROSOFT-CDO-IMPORTANCE:1
    X-MICROSOFT-CDO-INSTTYPE:0
    X-MICROSOFT-CDO-INTENDEDSTATUS:FALSE
    END:VEVENT
    END:VCALENDAR
    --===============1854598015118304554==--
    --===============0735652256227437116==
    Content-Type: application/ics; name="invite.ics"
    MIME-Version: 1.0
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment; filename="invite.ics"
    
    BEGIN:VCALENDAR
    VERSION:2.0
    METHOD:REQUEST
    PRODID:-//PYVOBJECT//NONSGML Version 1//EN
    BEGIN:VTIMEZONE
    TZID:IST
    BEGIN:STANDARD
    DTSTART:20000101T000000
    RRULE:FREQ=YEARLY;BYMONTH=1
    TZNAME:IST
    TZOFFSETFROM:+0530
    TZOFFSETTO:+0530
    END:STANDARD
    END:VTIMEZONE
    BEGIN:VEVENT
    UID:IoCJJ_840167408_31@example.com
    DTSTART;TZID=IST:20110621T200000
    DTEND;TZID=IST:20110621T210000
    ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP
     =TRUE:mailto:...@example.com
    CLASS:
    CREATED:20110621T052344Z
    DESCRIPTION:A test meeting.\n
    DTSTAMP:20110621T133143Z
    LAST-MODIFIED:20110621T133143Z
    LOCATION:
    ORGANIZER:mailto:...@example.com
    PRIORITY:5
    SEQUENCE:1
    STATUS:CONFIRMED
    SUMMARY:Test Meeting
    TRANSP:OPAQUE
    X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
    X-MICROSOFT-CDO-APPT-SEQUENCE:1
    X-MICROSOFT-CDO-BUSYSTATUS:BUSY
    X-MICROSOFT-CDO-IMPORTANCE:1
    X-MICROSOFT-CDO-INSTTYPE:0
    X-MICROSOFT-CDO-INTENDEDSTATUS:FALSE
    END:VEVENT
    END:VCALENDAR
    --===============0735652256227437116==--
    

This email works in every environment like Thunderbird/Lightening, Outlook
(without Exchange backend), GMail Calender, etc. except when the calendering
is handled by Exchange.

Can anyone tell me what is wrong and how to solve it.


Answer: Exchange strips out the content of the email when an application/ics
attachment is included. If that alternate view is removed, then the problem
should clear itself up.

