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

Free Support Forum - aspose.com

Not able to set duration in appointment

Hello Team,

I’ve been using Aspose.Email for creating appointments in PST file.

Can you please tell me how to set Duration of Appointment, cause i cannot find a way to set by property or by MAPI Property.

Thanks in advance.

Hi Amit,

Thank you for your inquiry.

Aspose.Email has exposed two properties of MapiCalendar class, namely are StartDate & EndDate to set the duration of appointment. Sample code snippet is attached for your reference. You can change the start and end date values according to your desired date and time.


Aspose.Email.Mapi.MapiMessage Mmsg = Aspose.Email.Mapi.MapiMessage.FromFile(@"App.msg");
Aspose.Email.Mapi.MapiCalendar objApp = (Aspose.Email.Mapi.MapiCalendar)msg.ToMapiMessageItem();
objApp.StartDate = DateTime.Now;
objApp.EndDate = DateTime.Now.AddDays(2);
using (Aspose.Email.Storage.Pst.PersonalStorage pst = Aspose.Email.Storage.Pst.PersonalStorage.Create(@"test.pst", Aspose.Email.Storage.Pst.FileFormatVersion.Unicode))
Aspose.Email.Storage.Pst.FolderInfo appFolder = pst.CreatePredefinedFolder("Appointments", Aspose.Email.Storage.Pst.StandardIpmFolder.Appointments);