VEVENTs lost when saving

Hello,
Kindly load the attached calendars and try to save as ICS
Appointment.Load
Appointment.Save
All VEVENTs with the exception of 1st one are lost when saving as a new ICS

I know loading ICS and saving as ICS does not make sense, but what if we load VCS and wanna save as ICS, or MSG with multiple VEVENTs and try to save as ICS.

Limit, bug or my bad usage?
Thank you :slight_smile:

calendars.zip (2.5 KB)

@australian.dev.nerds,

Appointment class is only for one event.

If you are reading a calendar, use CalendarReader:

var appointments = new List<Appointment>();

var reader = new CalendarReader(@"cal2.ics");

while (reader.NextEvent())
{
    appointments.Add(reader.Current);
}
1 Like

oops, thank you very much for the tip, I was doing all calendar things wrong all the time :frowning:
indeed, I’ve learned a lot from you, appreciate it :slight_smile:

Hi,
If you don’t mind please, 3 questions

For all the tasks below, my purpose is only convert msg/ics/vcs to ics or msg and to save it as mht for display only.

  1. When reading an input msg/ics/vcs that might be single or multi event, appointment or whole calendar shall I first detect its type somehow and then load based on its type, or is it safe to always use the calendar reader as you mentioned?

  2. Is this valid to convert VCS to ICS, preserving all the inner calendar data and events, etc?

  3. What if we need to load msg which might be whole calendar, multi or single event(s), and save it as ICS preserving all the inner data/events?

Thanks :slight_smile:

CalendarReader does not expose the Dispose method implemented from IDisposable, what about adding .Dispose to CalendarReader to have avail of Using CalendarReader?
Thanks :slight_smile:

And one more thing: When loading multi event ics/vcs/msg and saving as/converting to mht for display purposes, how to render all events details using Aspose default mht header renderer?

@australian.dev.nerds,

You can always use CalendarReader.

Yes, it is valid to convert a vCalendar (.vcs) file to an iCalendar (.ics) file using the code you have provided.

It seems that msg is not represent a calendar, only one event.

Okay, we’ll see.

You can display only one event in an mht.