koodaamo / tnefparse

a TNEF decoding library written in python, without external dependencies
GNU Lesser General Public License v3.0
49 stars 37 forks source link

converting winmail.dat tnef mapi calender invitation to .ics file #115

Open pasikarkkainen opened 3 years ago

pasikarkkainen commented 3 years ago

First of all thanks a lot for tnefparse, it rocks! It seems to be the only opensource util/library that has so far managed to parse this winmail.dat file I have here..

My question is: are there any plans to support generating .ics files from winmail.dat MAPI calender invitations? For example MS Exchange 2010 seems to send such winmail.dat files (and some organizations still seem to use such an old servers..). Based on some googling newer Exchange servers and/or Outlook clients might send such winmail.dat invitations aswell.

If I understand correctly such winmail.dat file does not include any real .ics attachments but instead the calender invitation is included in the MAPI fields/objects/properties.. like this:

$ tnefparse -o winmail.dat  -b

Overview of winmail.dat:

  Attachments:

  Objects:

    TNEF Version
    OEM Codepage
    Message ID
    Priority
    Date Sent
    Date Modified
    Message Class
    Subject
    Date Start
    Date End
    Owner Appointment ID
    Response Requested
    MAPI Properties

  Properties:

    MAPI_TNEF_CORRELATION_KEY
    MAPI_SENT_REPRESENTING_NAME
    MAPI_SENT_REPRESENTING_EMAIL_ADDRESS
    MAPI_SENT_REPRESENTING_ADDRTYPE
    MAPI_SENT_REPRESENTING_ENTRYID
    MAPI_SENT_REPRESENTING_SMTP_ADDRESS
    MAPI_SIP_ADDRESS
    MAPI_SENDER_NAME
    MAPI_SENDER_EMAIL_ADDRESS
    MAPI_SENDER_ADDRTYPE
    MAPI_SENDER_ENTRYID
    MAPI_SENDER_SMTP_ADDRESS 
    MAPI_SEND_RICH_INFO
    MAPI_MESSAGE_CLASS
    MAPI_MESSAGE_LOCALE_ID   
    MAPI_SEND_RICH_INFO
    MAPI_MESSAGE_CODEPAGE
    MAPI_SEARCH_KEY
    MAPI_IMPORTANCE
    MAPI_CLIENT_SUBMIT_TIME  
    MAPI_LAST_MODIFICATION_TIME
    MAPI_OWNER_APPT_ID
    MAPI_START_DATE
    MAPI_END_DATE
    MAPI_READ_RECEIPT_REQUESTED
    MAPI_ORIGINATOR_DELIVERY_REPORT_REQUESTED
    MAPI_LAST_MODIFIER_NAME  
    MAPI_REPLY_REQUESTED
    MAPI_RESPONSE_REQUESTED  
    MAPI_SUBJECT
    MAPI_SUBJECT_PREFIX
    MAPI_SENSITIVITY
    MAPI_ORIGINAL_SENSITIVITY
    MAPI_CONVERSATION_INDEX  
    MAPI_CONVERSATION_TOPIC  
    MAPI_SMTP_MESSAGE_ID
    MAPI_INTERNET_CODEPAGE   
    MAPI_ICON_INDEX
    MAPI_CREATION_TIME
    MAPI_ALTERNATE_RECIPIENT_ALLOWED
    MAPI_PRIORITY
    MAPI_RECIPIENT_REASSIGNMENT_PROHIBITED
    MAPI_NON_RECEIPT_NOTIFICATION_REQUESTED
    MAPI_TARGET_ENTRY_ID
    MAPI_CONVERSATION_ID
    MAPI_CREATOR_NAME
    MAPI_CREATOR_ADDRESS_TYPE
    MAPI_CREATOR_EMAIL_ADDRESS
    MAPI_SENDER_SIMPLE_DISPLAY_NAME
    MAPI_SENT_REPRESENTING_SIMPLE_DISPLAY_NAME
    MAPI_CREATOR_SIMPLE_DISP_NAME
    MAPI_LAST_MODIFIER_SIMPLE_DISPLAY_NAME
    MAPI_INTERNET_MAIL_OVERRIDE_FORMAT
    MAPI_MESSAGE_EDITOR_FORMAT
    MAPI_STORE_SUPPORT_MASK  
<body text goes here>
petri commented 3 years ago

Thanks for the compliments, good to hear. The scope of tnefparse is just that - parsing. Is there something more that it should be able to parse, maybe somehow better, to support your use case of converting to .ics ? (nice idea btw)

jrideout commented 3 years ago

The relevant MS doc seems to be MS-OXCICAL. Though it describes how to convert ical to mapi/tnef, I suspect one could use the same reference for the reverse operation. At a glance, that we may not parse looks like the recipient tracking/reply information.

timtomch commented 2 years ago

I had the same issue and it was driving me nuts, so I wrote a short script using tnefparse to extract the calendar invitation data to an .ics file: https://github.com/timtomch/tnef2ics/

Maybe if I figure out how to do it I will do a PR to have this functionality added to the tnefparse command-line tool.