I am using the following code to export an appointment as a .ics file
Dim properties = New PropertySet(BasePropertySet.FirstClassProperties, ItemSchema.MimeContent, AppointmentSchema.RequiredAttendees, AppointmentSchema.OptionalAttendees)
Dim item = Appointment.Bind(_exchangeService, New ItemId(itemId), properties)
Using fileStream = File.OpenWrite("C:\Test\appt.ics")
fileStream.Write(item.MimeContent.Content, 0, item.MimeContent.Content.Length)
End Using
The resulting .ics file does not include any data for Attendees. How can i export this data?
When debugging, the RequiredAttendees
property on item
is populated with data.
If I export directly from Outlook, using File > Save As
, the attendee information IS there.
Example output:
From outlook 'Save As': https://gist.github.com/rhamache/932365fab68af947686f7e7b45bb84bf
From EWS exported file: https://gist.github.com/rhamache/61509c718da6f8072c0694958eb8ac70
As you can see, the .ics
file generated from EWS is missing Attendees, and X-ALT-DESC
(probably other things are missing too)
I have access to Aspose if it simplifies things
This is normal and to be expected in EWS see https://msdn.microsoft.com/en-us/library/office/dn672316(v=exchg.150).aspx
The Appointment MIME stream is an iCal (.ics) file. The .ics format is convenient because Outlook and other email clients can identify it. This is not a viable option for exporting meetings because attendee information is not provided in the MIME stream. Attachments and other properties might not be included in the MIME stream. Consider constructing the iCal format from either the Appointment object or from the XML returned by the GetItem operation. This way, you can capture more of the Exchange properties with extended properties ("X-‘ properties) in the iCal file. You can also export an appointment in XML form. Call the GetItem operation and save the XML in your system. You can also use the tracing functionality in the EWS Managed API to capture the XML to put in an XML databas