被承认我有一个用于创建C#观的新实例不会在溶液
不幸的是,对Outlook中的一个新的约会时,我设置Outlook
Outlook.Application outlookApp = new Outlook.Application(); // creates new outlook app
“outlookApp的新实例代码“错误24字段初始值设定项不能引用非静态字段,方法或属性 ) Outlook.AppointmentItem oAppointment =(Outlook.AppointmentItem)outlookApp.CreateItem(Outlook.OlItemType .olAppointmentItem);
整个代码仅供参考。
Outlook.Application outlookApp = new Outlook.Application(); // creates new outlook app
Outlook.AppointmentItem oAppointment = (Outlook.AppointmentItem)outlookApp.CreateItem(Outlook.OlItemType.olAppointmentItem); // creates a new appointment
oAppointment.Subject = "Holiday request for " + name ; // set the subject
oAppointment.Body = " "; // set the body/send details of contact form below
oAppointment.Location = "Nicks Desk!"; // set the location
oAppointment.Start = Convert.ToDateTime(notesDate); // Set the start date NEEDS TO BE THE DATE THAT THE USER ENTERS IN DATEFROM
oAppointment.End = Convert.ToDateTime(notesDate); // End date NEEDS TO BE THE DATE THAT THE USER ENTERS IN DATETO
oAppointment.ReminderSet = true; // Set the reminder
oAppointment.ReminderMinutesBeforeStart = 15; // reminder time
oAppointment.Importance = Outlook.OlImportance.olImportanceHigh; // appointment importance
oAppointment.BusyStatus = Outlook.OlBusyStatus.olBusy;
oAppointment.Save();
Outlook.MailItem mailItem = oAppointment.ForwardAsVcal();
//who is sending the email
mailItem.SentOnBehalfOfName = NameInput;
// email address to send to
mailItem.To = "mailto:[email protected]">[email protected];
// send
mailItem.Send();
任何想法?
你会得到什么错误? – SLaks
错误字段初始值设定项无法引用非静态字段,方法或属性 关于outlookApp – DevAL