【发布时间】:2017-03-29 21:37:49
【问题描述】:
我正在用 C# 创建一个 Windows 应用程序,用于在我的团队的共享日历中设置约会。我是日历的所有者。我已经编写了代码来设置约会并将提醒时间设置为会议前 24 小时。但是,它不是向与会者发送提醒,而是向我发送提醒。我为此使用 Microsoft.Office.Interop.Outlook。这是我使用的代码:
Outlook.Application oApp = new Outlook.Application();
// Get the NameSpace and Logon information.
Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
// Get the Calendar folder.
Outlook.Recipient rcip = oNS.CreateRecipient("abc@domain.com");
Outlook.MAPIFolder oSharedCal = oNS.GetSharedDefaultFolder(rcip, Outlook.OlDefaultFolders.olFolderCalendar);
Outlook.MAPIFolder oShiftCal = oSharedCal.Folders["Sample"];
// Get the Items (Appointments) collection from the Calendar folder.
Outlook.Items oItems = oSharedCal.Items;
Outlook.AppointmentItem oAppt = (Outlook.AppointmentItem)oItems.Add();
// Set Appointment properties.
oAppt.Subject = Subject;
oAppt.Start = start;
oAppt.End = end;
oAppt.RequiredAttendees = email;
oAppt.ReminderMinutesBeforeStart = 24 * 60;
oAppt.ReminderSet = true;
oAppt.BusyStatus = Outlook.OlBusyStatus.olFree;
//Show the item to pause.
oAppt.Save();
oAppt.Send();
谁能帮我解决这个问题?
【问题讨论】:
-
请仅使用 [visual-studio] 标签来回答有关工具本身的问题。
标签: c# outlook calendar appointment