OfficeDev / ews-managed-api

Other
585 stars 321 forks source link

Exchange Web Services get appointment as MIME #254

Open slavag opened 4 years ago

slavag commented 4 years ago

I'm trying to get iCal from EWS appointment (https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-export-items-by-using-ews-in-exchange). In general it's works fine, but something goes wrong when appointment is recurring with modified occurrences (exceptions), them MIME content received on master recurring event contains all it's modified occurrences : _BEGIN:VCALENDAR METHOD:PUBLISH PRODID:Microsoft Exchange Server 2010 VERSION:2.0 BEGIN:VTIMEZONE TZID:Israel Standard Time BEGIN:STANDARD DTSTART:16010101T020000 TZOFFSETFROM:+0300 TZOFFSETTO:+0200 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10 END:STANDARD BEGIN:DAYLIGHT DTSTART:16010101T020000 TZOFFSETFROM:+0200 TZOFFSETTO:+0300 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1FR;BYMONTH=3 END:DAYLIGHT END:VTIMEZONE BEGIN:VEVENT ORGANIZER;CN=Slava:mailto:slava@domain.onmicrosoft.com ATTACH:CID:408BD82990C789226A32C4E6F8D7E592D9DD5960@eurprd01.prod.exchangel abs.com RRULE:FREQ=WEEKLY;UNTIL=20200401T050000Z;INTERVAL=1;BYDAY=WE;WKST=SU UID:040000008200E00074C5B7101A82E00800000000D263C072E37DD501000000000000000 01000000021933B3497010A43A59A900692A1BE23 SUMMARY;LANGUAGE=en-US:Recurrent 1 DTSTART;TZID=Israel Standard Time:20191009T080000 DTEND;TZID=Israel Standard Time:20191009T083000 CLASS:PUBLIC PRIORITY:5 DTSTAMP:20200401T060210Z TRANSP:OPAQUE STATUS:CONFIRMED SEQUENCE:0 LOCATION;LANGUAGE=en-US: X-MICROSOFT-CDO-APPT-SEQUENCE:0 X-MICROSOFT-CDO-OWNERAPPTID:2117746898 X-MICROSOFT-CDO-BUSYSTATUS:BUSY X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY X-MICROSOFT-CDO-ALLDAYEVENT:FALSE X-MICROSOFT-CDO-IMPORTANCE:1 X-MICROSOFT-CDO-INSTTYPE:1 X-MICROSOFT-DONOTFORWARDMEETING:FALSE X-MICROSOFT-DISALLOW-COUNTER:FALSE X-MICROSOFT-LOCATIONS:[] BEGIN:VALARM DESCRIPTION:REMINDER TRIGGER;RELATED=START:-PT15M ACTION:DISPLAY END:VALARM END:VEVENT BEGIN:VEVENT UID:040000008200E00074C5B7101A82E00800000000D263C072E37DD501000000000000000 01000000021933B3497010A43A59A900692A1BE23 RECURRENCE-ID;TZID=Israel Standard Time:20191023T080000 SUMMARY:Recurrent 11 DTSTART;TZID=Israel Standard Time:20191023T080000 DTEND;TZID=Israel Standard Time:20191023T083000 CLASS:PUBLIC PRIORITY:5 DTSTAMP:20191112T145232Z TRANSP:OPAQUE STATUS:CONFIRMED SEQUENCE:0 LOCATION: X-MICROSOFT-CDO-APPT-SEQUENCE:0 X-MICROSOFT-CDO-OWNERAPPTID:2117746898 X-MICROSOFT-CDO-BUSYSTATUS:BUSY X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY X-MICROSOFT-CDO-ALLDAYEVENT:FALSE X-MICROSOFT-CDO-IMPORTANCE:1 X-MICROSOFT-CDO-INSTTYPE:3 X-MICROSOFT-DONOTFORWARDMEETING:FALSE X-MICROSOFT-DISALLOW-COUNTER:FALSE END:VEVENT END:VCALENDAR

And it's no that that difficult to filter out modified occurrences as they have have RECURRENCE-ID that distinguish between master recurring and modified occurrence. The issue is then, when I trying to bring by using EWS all modified occurrences from that master : https://docs.microsoft.com/en-us/dotnet/api/microsoft.exchange.webservices.data.appointment.modifiedoccurrences?view=exchange-ews-api#Microsoft_Exchange_WebServices_Data_Appointment_ModifiedOccurrences and reqesting MIME for each mofified occurence brings MIME that contains again all modified ocurences for that master and now it's very difucult to filter out not relevant events, as I'm getting too many, for example with 1 master and 3 modified in total I'll get by MIME 10 events (1 master and 3 modified in each MIME request) and those are duplicates. Please see below example of MIME for modified occurrence (it contains same event twice, second time without some properties, while first event has RRULE definition together with RECURRENCE-ID that is comes in contradiction with iCal RFC):

_BEGIN:VCALENDAR METHOD:PUBLISH PRODID:Microsoft Exchange Server 2010 VERSION:2.0 BEGIN:VTIMEZONE TZID:Israel Standard Time BEGIN:STANDARD DTSTART:16010101T020000 TZOFFSETFROM:+0300 TZOFFSETTO:+0200 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10 END:STANDARD BEGIN:DAYLIGHT DTSTART:16010101T020000 TZOFFSETFROM:+0200 TZOFFSETTO:+0300 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1FR;BYMONTH=3 END:DAYLIGHT END:VTIMEZONE BEGIN:VEVENT ORGANIZER;CN=Slava mailto:slava@domain.onmicrosoft.com ATTACH:CID:C193186C7E6D4769FD7EB28C80DBC92443A1190C@eurprd01.prod.exchangel abs.com DESCRIPTION;LANGUAGE=en-US:\n RRULE:FREQ=WEEKLY;UNTIL=20200401T050000Z;INTERVAL=1;BYDAY=WE;WKST=SU UID:040000008200E00074C5B7101A82E00800000000D263C072E37DD501000000000000000 01000000021933B3497010A43A59A900692A1BE23 RECURRENCE-ID;TZID=Israel Standard Time:20191023T080000 SUMMARY;LANGUAGE=en-US:Recurrent 1_1 DTSTART;TZID=Israel Standard Time:20191023T080000 DTEND;TZID=Israel Standard Time:20191023T083000 CLASS:PUBLIC PRIORITY:5 DTSTAMP:20191112T145232Z TRANSP:OPAQUE STATUS:CONFIRMED SEQUENCE:0 LOCATION;LANGUAGE=en-US: X-MICROSOFT-CDO-APPT-SEQUENCE:0 X-MICROSOFT-CDO-OWNERAPPTID:2117746898 X-MICROSOFT-CDO-BUSYSTATUS:BUSY X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY X-MICROSOFT-CDO-ALLDAYEVENT:FALSE X-MICROSOFT-CDO-IMPORTANCE:1 X-MICROSOFT-CDO-INSTTYPE:3 X-MICROSOFT-DONOTFORWARDMEETING:FALSE X-MICROSOFT-DISALLOW-COUNTER:FALSE X-MICROSOFT-LOCATIONS:[] END:VEVENT BEGIN:VEVENT UID:040000008200E00074C5B7101A82E00800000000D263C072E37DD501000000000000000 01000000021933B3497010A43A59A900692A1BE23 RECURRENCE-ID;TZID=Israel Standard Time:20191023T080000 SUMMARY:Recurrent 11 DTSTART;TZID=Israel Standard Time:20191023T080000 DTEND;TZID=Israel Standard Time:20191023T083000 CLASS:PUBLIC PRIORITY:5 DTSTAMP:20191112T145232Z TRANSP:OPAQUE STATUS:CONFIRMED SEQUENCE:0 LOCATION: X-MICROSOFT-CDO-APPT-SEQUENCE:0 X-MICROSOFT-CDO-OWNERAPPTID:2117746898 X-MICROSOFT-CDO-BUSYSTATUS:BUSY X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY X-MICROSOFT-CDO-ALLDAYEVENT:FALSE X-MICROSOFT-CDO-IMPORTANCE:1 X-MICROSOFT-CDO-INSTTYPE:3 X-MICROSOFT-DONOTFORWARDMEETING:FALSE X-MICROSOFT-DISALLOW-COUNTER:FALSE END:VEVENT END:VCALENDAR

Is there any way to get MIME that has only one event for each appointment in MIME ? Or this is a bug ?

Thanks