회의 요청 전송

Contents
[ ]

VSTO

Outlook 클래스를 사용하려면 .NET 프로젝트에 Outlook.Interop를 참조해야 합니다. 아래 코드 스니펫:

  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 for .NET을 사용하여 회의 요청을 보내는 예시입니다. 먼저 Aspose.Email.Appointment 클래스로 회의 요청을 생성하고, Aspose.Email.Mail.SmtpClient 클래스를 사용해 이메일에 회의 요청을 첨부하여 전송합니다.

Aspose.Email for .NET 사용의 장점

Outlook Interop은 해당 시스템에 Microsoft Outlook이 설치되어 있어야 합니다. Aspose.Email for .NET은 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);

##샘플 코드 다운로드