We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Issue Convert EML to ICS

I am trying to extract or convert eml to ics
below is my code
using Aspose.Email.Mapi;

var message = MapiMessage.FromFile(“C:\GitHub\ReadEmailCal\{AD3FD25E-4EE0-41F2-BFD1-F005CA122EBE}.eml”);
Log.Information(“trying to save ICS”);
message.Save(“C:\GitHub\ReadEmailCal\SavedFile3.ics”,SaveOptions.DefaultIcs);

I get the following error:
‘SaveOptions’ does not contain a definition for ‘DefaultIcs’
how should I proceed?

@sjamilCS

We are working over your query and will get back to you soon.

@sjamilCS

In general, it is impossible to convert EML to ICS because they are different independent formats.

Following code example shows how to AlternateView can be saved in ICS format. Hope this helps you.

var msg = MailMessage.Load(@"d:\some.eml");
foreach (var view in msg.AlternateViews)
{
    if (view.ContentType.MediaType == "text/calendar")
    {
        view.Save(@"d:\some.ics");
    }
}

Hi Tahir,

Thanks for code, it appears to accomplish want I wanted. This ticket can be closed.