Adding attachments to mapicalendar object

Hi



I need to add attachments in calendar item of outlook.
For which I am writing an c# application .
I have created MapiCalendar Object but
didn’t find any method to add attachments from my disk
to outlook.

Could you please help.

Thanks & Regards
Amol Sonawane

Hi Amol,

MapiCalendar represent pure calendar items and attachments can be added to MailMessage or MapiMessage only. Please have a look at one of the possible code samples that initializes an Appointment object and adds an attachment to its MailMessage view.

Sample Code:

Appointment appointment = new Appointment(
    "Meeting Room 3 at Office Headquarters", // Location
    "Monthly Meeting", // Summary
    "Please confirm your availability.", // Description
    DateTime.Now,
    DateTime.Now.AddHours(2),
    "from@domain.com", // Organizer
    "attendees@domain.com" // Attendees
);

// Save the appointment in ICS format
MemoryStream memStream = new MemoryStream();
appointment.Save(memStream, AppointmentSaveFormat.Ics);

MailMessage mailMsg = new MailMessage();
mailMsg.AddAlternateView(appointment.RequestApointment());

//add the attachment to message
mailMsg.Attachments.Add(new Attachment("About Aspose.pdf"));

MapiMessage mapiMsg = MapiMessage.FromMailMessage(mailMsg);
mapiMsg.Save("TCA2.msg");

Hi


The code which you have provided made me aware of many hidden things.
It worked fine I got the .msg file which has attachment.

But when I add this mapimessage by loading through msg file in the folder .

f_FolderInfoObj.AddMessage(MapiMessage.FromFile(“CalendarAttach.msg”));

I get all the field set except the attcahments
I have taken form msg file which has saved
Same as above code you have provided

I need the calendar item which has attchments to be saved in pst.
So that I can view in outlook. How should i proceed?
Can i get the exact link which can help me to know all the classes of aspose.dll that are used with calendar item.

Thanks & Regards
Amol Sonawane




.

Hi Amol,


This seems to me a bug at Aspose.Email end as if we send the mail message (to which the attachment is added) using Smtp or any other method, the attachment is available at the receiving end. I’m further investigating this issue and will soon share my findings here. Your patience until then is highly appreciated.

Hi Amol,


After further investigation into this issue, I have logged it as NETWORKNET-34052 in our issue tracking system under issue id: NETWORKNET-34052 for further consideration by the development team. Once there is some work around method or fix is available, we’ll update you here via this thread.

The issues you have found earlier (filed as NETWORKNET-34052) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.