약속 만들기

VSTO

다음은 약속을 생성하고 저장하는 코드 스니펫입니다:


   Outlook.AppointmentItem appt = Application.CreateItem(

  Outlook.OlItemType.olAppointmentItem) as Outlook.AppointmentItem;

  appt.Subject = "Developer's Conference";

  appt.AllDayEvent = true;

  appt.Start = DateTime.Parse("6/11/2007 12:00 AM");

  appt.End = DateTime.Parse("6/16/2007 12:00 AM");

  appt.Display(false);

Aspose.Email

약속을 생성하고 ICS 형식으로 저장하려면 다음 단계가 필요합니다.

  1. Appointment 클래스를 인스턴스화하고 이 생성자를 사용하여 초기화합니다.
  2. 위 생성자에 다음 인수를 전달합니다
    1. 참석자
    2. 설명
    3. 종료 날짜
    4. 위치
    5. 주최자
    6. 시작 날짜
    7. 요약
  3. Save() 메서드를 호출하고 인수에 파일 이름과 형식을 지정합니다.

이 약속은 Microsoft Outlook이나 ICS 파일을 로드할 수 있는 모든 프로그램에서 열 수 있습니다. 파일을 Microsoft Outlook에서 열면 자동으로 Outlook 캘린더에 약속이 추가됩니다.

다음 코드 스니펫은 약속을 생성하고 이를 ICS 형식으로 디스크에 저장합니다.


   string location = "Meeting Location: Room 5";

  DateTime startDate = new DateTime(1997, 3, 18, 18, 30, 00),

  endDate = new DateTime(1997, 3, 18, 19, 30, 00);

  MailAddress organizer = new MailAddress("aaa@amail.com", "Organizer");

  MailAddressCollection attendees = new MailAddressCollection();

  attendees.Add(new MailAddress("bbb@bmail.com", "First attendee"));

  Appointment target = new Appointment(location, startDate, endDate, organizer, attendees);

  target.Save("savedFile.ics");

샘플 코드 다운로드

실행 코드 다운로드