我已经做了一些研究,并没有找到我的确切问题的例子,虽然有很多很抱歉,如果我错过了它。使用Outlook.AppointmentItem o预约特定用户
我有一些代码会自动添加约会到我的Outlook日历,然后发送电子邮件给收件人。但是现在我希望能够将其添加到通用用户名的公共日历中...所以我使用的代码仅将其添加到已登录的用户日历中。
继承此问题的代码在按下按钮:
private void button1_Click(object sender, EventArgs e)
{
string name = "Test Name";
DateTime startDate = new DateTime(2015, 4, 2);
DateTime endDate = new DateTime(2015, 4, 2);
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 = "Enquiry Changes made to " + name + "'s enquiry"; // set the subject
oAppointment.Body = "This is where the appointment body of the appointment is written"; // set the body
oAppointment.Location = "The location"; // set the location
oAppointment.Start = Convert.ToDateTime(startDate); // Set the start date
oAppointment.End = Convert.ToDateTime(endDate); // End date
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();
// email address to send to
mailItem.To = "[email protected]";
// send
mailItem.Send();
}
感谢任何帮助,您可以给我....并澄清,我希望能够将约会添加到特定用户的日历,而不是为用户当前登录到机器上。
这里是极为相似的链接,但是也没有一个公认的回答:How to set an appointment to other users on outlook?
恩,你链接到_does_的另一个问题有一个答案。 – RenniePet 2015-04-02 08:39:55
它没有被接受,并提供的链接是没有用的......我尝试使用此: https://www.add-in-express。com/creation-addins-blog/2011/11/04/outlook-create-appointment-item/ 但它不起作用 – Crezzer7 2015-04-02 08:44:56
我不明白。该主题的答案已被接受,并且Dmitry Streblechenko是与Outlook接口的头号专家。他是Outlook Spy的作者,这是一个用于调查Outlook使用的MAPI结构的伟大程序。 http://www.dimastr.com/outspy/home.htm – RenniePet 2015-04-02 08:59:07