ICS file giving exception (Given key) while Appointment.load

Dear Team,

I am facing issue while loading ICS file using above code:

calDoc = Appointment.Load(strTempNewIcs, new AppointmentLoadOptions() { IgnoreSmtpAddressCheck = true });

Its giving exception that The given key was not present in the dictionary. Plz find below my sample.
tempIcs.zip (1.2 KB)

Regards
XCoder

@perfectdata.techno

Cause

The exception “The given key was not present in the dictionary” typically indicates that the ICS file you are trying to load may have some missing or unexpected data that the Appointment.Load method cannot handle. This can happen if the ICS file is not formatted correctly or if it contains elements that the library does not recognize.

Solution

To troubleshoot this issue, follow these steps:

  1. Validate the ICS File: Ensure that the ICS file is correctly formatted. Use online validators for ICS files to check for any structural issues.

  2. Check for Required Fields: Make sure that all required fields in the ICS file are present. Missing fields can lead to exceptions during loading.

  3. Use Try-Catch Block: Implement a try-catch block around your loading code to capture more detailed error information. This can help identify the specific part of the ICS file causing the issue.

  4. Test with a Simple ICS File: Create a minimal ICS file with basic appointment details and see if it loads successfully. This can help determine if the issue is with the specific ICS file you are using.

Code

Here’s a sample code snippet to implement the try-catch block:

try
{
    var calDoc = Appointment.Load(strTempNewIcs, new AppointmentLoadOptions() { IgnoreSmtpAddressCheck = true });
}
catch (Exception ex)
{
    Console.WriteLine($"Error loading ICS file: {ex.Message}");
}

Next Steps

If the problem persists after validating the ICS file and checking for required fields, reach out to Aspose support with the specific ICS file that is causing the issue. They can provide more detailed insights based on the file’s content.

Please let me know if you need further assistance!

Hello @perfectdata.techno,

Thank you for your message.

We were able to reproduce the issue you encountered while loading the ICS file using the provided code. A corresponding ticket has been created in our internal issue tracking system for further investigation and resolution.

Issue ID(s): EMAILNET-41609

We will keep you informed of any updates regarding this matter.