Free Support Forum -

How to add calendar info from ics and contact info from vcard to PST file


Please advise how to load calendar info in ICS format from a InputStream and insert into a PST file.

There is no constructor or static method in MapiCalendar that takes an InputStream?

For example, to add a message to a PST file, I use the following:

MailMessage message = MailMessage.load(is, FileCompatibilityMode.SkipValidityChecking);MapiMessage mapimsg = MapiMessage.fromMailMessage(message,OutlookMessageFormat.Unicode);

How do I accomplish the same thing when I have ICS or VCard data and I wish to add a calendar entry or contact to the PST file?



Hi Jamie,

Thank you for writing to us.

Please have a look at the following source code that loads an appointment from ICS file and adds it to the PST. Please let us know if you have any additional query/inquiry related to Aspose.Email.

Example Code:

Appointment appointment = Appointment.Load(“Test.ics”); <o:p></o:p>

// Save the appointment to disk in ICS format

MemoryStream memStream = new MemoryStream();

appointment.Save(memStream, AppointmentSaveFormat.Ics);

MailMessage mailMsg = new MailMessage();


MapiMessage mapiMsg = MapiMessage.FromMailMessage(mailMsg);

// Create new PST

PersonalStorage pst = PersonalStorage.Create("TestCalendar.pst", FileFormatVersion.Unicode);

// Add new folder "Calendar"

pst.CreatePredefinedFolder("Calendar", StandardIpmFolder.Appointments);

FolderInfo folderInfo = pst.GetPredefinedFolder(StandardIpmFolder.Appointments);