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

Free Support Forum - aspose.com

Setting X-ALT-DESC in ICAL

We are using Aspose.Email to create ICAL files. While we set the body content like this

mapiEvent.SetBodyContent(@event.Body.Content, BodyContentType.Html);

The resulting ICAL does not set the X-ALT-DESC header. Am I missing something here? Could you please let me know how can I set the X-ALT-DESC header?

@saitx

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input document.
  • Please attach the output ICAL file that shows the undesired behavior.
  • Please attach the expected output ICAL file that shows the desired behavior.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

1 Like

Hi @tahir.manzoor,

Thanks for the quick reply. Here is the code snippet

        var license = new License();
        license.SetLicense("Aspose.Total.NET.lic");

        const string body = @"<html><h1>This is the header</h1><p>This is the message</p></html>";
        var attendees = new MailAddressCollection {new MailAddress("xxxxxx@yyyy.com", "xxx yyyyy")};
        var appointment = new Appointment("War Room",
            DateTime.UtcNow, DateTime.UtcNow.AddHours(1),
            new MailAddress("xxxxxx@yyyy.com", "xxx yyyyy"), attendees)
        {
            IsDescriptionHtml = true
        };
        
        var mailMessage = new MailMessage();
        mailMessage.AddAlternateView(appointment.RequestApointment());
        var mapi = MapiMessage.FromMailMessage(mailMessage);
        var mapiEvent = (MapiCalendar) mapi.ToMapiMessageItem();
        mapiEvent.Subject = "War room meeting";
        mapiEvent.SetBodyContent(body, BodyContentType.Html);
        mapiEvent.Save("testevent.ics", AppointmentSaveFormat.Ics);

ICS.zip (6.7 KB)

Please see the attached. It has two ICS files

  1. AsposeOutput.ics - this is the output of the code above
  2. Expected.ics - this is an ICS saved from a similar appointment created from Outlook.

If you see, the “Expected.ics” has a header “X-ALT-DESC” which contains the html content and “Asposeoutput.ics” is missing it, even though the HTML content is set through the code. Due to this, once the ICS file is shared, it is losing the formatting and the appointment is created with plain text in the description.

Hope this describes the problem. Please let met know in case you have further questions.

@saitx

We have logged a new ticket in our issue tracking system as EMAILNET-40547 for your requirement. We will inform you via this forum thread once there is an update available on it.

We apologize for your inconvenience.

1 Like