How to set an appointment to other users on outlook?

匆匆过客 提交于 2019-12-25 18:32:38

问题


Let's say I log in to the OS with administrator account and have permissions to set appointments to other users, without sending a mail.

How can I do it in the code? I could only find examples working with AppontmentItem and set an appointment to the local machine's outlook. How can I do it for external users?

Many thanks in advance!

    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:


Use Namespace.GetSharedDefaultFolder() to open other user's Calendar folder, then create an appointment using MAPIFolder.Items.Add.



来源:https://stackoverflow.com/questions/25365604/how-to-set-an-appointment-to-other-users-on-outlook

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!