สร้างการนัดหมาย
Contents
[
Hide
]
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.
- สร้างอินสแตนซ์ของคลาส Appointment และเริ่มต้นด้วยคอนสตรัคเตอร์นี้.
- ส่งอาร์กิวเมนต์ต่อไปนี้ในคอนสตรกเตอร์ด้านบน
- ผู้เข้าร่วม
- คำอธิบาย
- วันที่สิ้นสุด
- สถานที่
- ผู้จัด
- วันที่เริ่มต้น
- สรุป
- เรียกเมธอด 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");