ارسال درخواست جلسه

Contents
[ ]

VSTO

برای استفاده از کلاس‌های Outlook، باید Outlook.Interop را در پروژه .NET خود ارجاع دهید. کد نمونه زیر:

  1. درخواست جلسه را ایجاد می‌کند.
  2. ویژگی‌هایی مانند موضوع، بدنه، مکان و زمان را تنظیم می‌کند.
  3. درخواست جلسه را به گیرنده ارسال می‌کند.
  4. Microsoft Outlook باید بر روی سیستمی که این برنامه نمونه اجرا می‌شود نصب باشد.

 // Create an instance of Outlook Application class

Outlook.Application outlookApp = new Outlook.Application();

// Create an instance of AppointmentItem object and set the properties:

Outlook.AppointmentItem oAppointment = (Outlook.AppointmentItem)outlookApp.CreateItem(Outlook.OlItemType.olAppointmentItem);

oAppointment.Subject = "subject of appointment";

oAppointment.Body = "body text of appointment";

oAppointment.Location = "Appointment location";

// Set the start date and end dates

oAppointment.Start = Convert.ToDateTime("01/22/2010 10:00:00 AM");

oAppointment.End = Convert.ToDateTime("01/22/2010 2:00:00 PM");

// Save the appointment

oAppointment.Save();

// Send the appointment

Outlook.MailItem mailItem = oAppointment.ForwardAsVcal();

mailItem.To = "recipient@domain.com";

mailItem.Send();

Aspose.Email

کد زیر از Aspose.Email برای .NET برای ارسال درخواست جلسه استفاده می‌کند. ابتدا درخواست جلسه را با استفاده از کلاس Aspose.Email.Appointment ایجاد می‌کنید. سپس ایمیل را ارسال می‌کنید، درخواست جلسه را پیوست می‌کنید و ایمیل را با استفاده از کلاس Aspose.Email.Mail.SmtpClient می‌فرستید.

مزایای استفاده از Aspose.Email برای .NET

Outlook Interop برای استفاده نیاز به نصب Microsoft Outlook بر روی سیستمی که استفاده می‌شود دارد. Aspose.Email برای .NET نیازی به نصب Microsoft Outlook ندارد و برای برنامه‌های سروری مناسب است.


  // Create attendees of the meeting

MailAddressCollection attendees = new MailAddressCollection();

attendees.Add("recipient1@domain.com");

attendees.Add("recipient2@domain.com");

// Set up appointment

Appointment app = new Appointment(

    "Location", // location of meeting

    DateTime.Now, // start date

    DateTime.Now.AddHours(1), // end date

    new MailAddress("organizer@domain.com"), // organizer

    attendees); // attendees

// Set up message that needs to be sent

MailMessage msg = new MailMessage();

msg.From = "from@domain.com";

msg.To = "to@domain.com";

msg.Subject = "appointment request";

msg.Body = "you are invited";

// Add meeting request to the message

msg.AddAlternateView(app.RequestApointment());

// Set up the SMTP client to send email with meeting request

SmtpClient client = new SmtpClient("host", 25 ,"user", "password");

client.Send(msg);

##دریافت کد نمونه