Shy*_*yju 7 .net c# automation outlook-2003
我试图创建在Microsoft Outlook中的约会使用下面的code.While运行这个程序(2003),另一人的压延机,该任命是得到保存在我的calender.But不会发送给收件人.
try
{
Microsoft.Office.Interop.Outlook.Application app = null;
Microsoft.Office.Interop.Outlook.AppointmentItem appt = null;
app = new Microsoft.Office.Interop.Outlook.Application();
appt = (Microsoft.Office.Interop.Outlook.AppointmentItem)app
.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
appt.Subject = "Meeting ";
appt.Body = "Test Appointment body";
appt.Location = "TBD";
appt.Start = Convert.ToDateTime("12/23/2009 05:00:00 PM");
appt.Recipients.Add("smuthumari@mycompany.com");
appt.End = Convert.ToDateTime("12/23/2009 6:00:00 PM");
appt.ReminderSet = true;
appt.ReminderMinutesBeforeStart = 15;
appt.Importance = Microsoft.Office.Interop.Outlook.OlImportance.olImportanceHigh;
appt.BusyStatus = Microsoft.Office.Interop.Outlook.OlBusyStatus.olBusy;
appt.Save();
appt.Send();
}
catch (COMException ex)
{
Response.Write(ex.ToString());
}
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?任何人都可以帮我解决这个问题吗?
预约后:
Outlook.MailItem mailItem = appt.ForwardAsVcal();
mailItem.To = "recipient's email address";
mailItem.Send();
Run Code Online (Sandbox Code Playgroud)
尝试添加:
appt.MeetingStatus = Microsoft.Office.Interop.Outlook.OlMeetingStatus.olMeeting;
Run Code Online (Sandbox Code Playgroud)
默认状态是一个我不确定是否已发送的约会。