如何在outlook上为其他用户设置约会?

时间:2014-08-18 14:21:13

标签: c# email outlook

假设我使用管理员帐户登录操作系统,并且有权在不发送邮件的情况下为其他用户设置约会。

我如何在代码中执行此操作? 我只能找到使用AppontmentItem的示例并将约会设置为本地计算机的outlook。如何为外部用户执行此操作?

非常感谢提前!

    private static void AddAppointment()
    {


            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 john enquiry"; // set the subject
            oAppointment.Body = "This is where the appointment body of the appointment is written"; // set the body
            oAppointment.Location = "Nicks Desk!"; // set the location
            oAppointment.Start = DateTime.Now.AddHours(2);
            oAppointment.End = DateTime.Now.AddHours(3);
            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();
    }

1 个答案:

答案 0 :(得分:0)

使用Namespace.GetSharedDefaultFolder()打开其他用户的日历文件夹,然后使用MAPIFolder.Items.Add创建约会。