我正在尝试使用c#windows应用程序为Outlook创建API。为此,要获取所有AppointmentItem,我使用下面的代码并且它正在工作。Outlook API在c#中获取会议详细信息#
Microsoft.Office.Interop.Outlook.Application oApp = null;
Microsoft.Office.Interop.Outlook.NameSpace mapiNamespace = null;
Microsoft.Office.Interop.Outlook.MAPIFolder CalendarFolder = null;
Microsoft.Office.Interop.Outlook.MAPIFolder Inbox = null;
Microsoft.Office.Interop.Outlook.Items outlookCalendarItems = null;
oApp = new Microsoft.Office.Interop.Outlook.Application();
mapiNamespace = oApp.GetNamespace("MAPI"); ;
mapiNamespace.Logon("", "",true, true);
CalendarFolder = mapiNamespace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar);
CalendarFolder = oApp.Session.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar);
DateTime startTime = DateTime.Now;
DateTime endTime = startTime.AddDays(5);
//string filter = "[Start] >= '" + startTime.ToString("g") + "' AND [End] <= '" + endTime.ToString("g") + "'";
outlookCalendarItems = CalendarFolder.Items;
// outlookCalendarItems.Restrict(filter);
// outlookCalendarItems.Sort("Start");
outlookCalendarItems.IncludeRecurrences = true;
int i = 0;
foreach (Microsoft.Office.Interop.Outlook.AppointmentItem item in outlookCalendarItems)
{
dataGridCalander.Rows.Add();
dataGridCalander.Rows[i].Cells[0].Value = i + 1;
if (item.Subject != null)
{
dataGridCalander.Rows[i].Cells[1].Value = item.Subject;
}
}
类似的方式,我想获得的前景和特定的会议室状态(可用与否)创建可用的会议室。提前致谢。
感谢您的回答。是否有可能获得资源? – 2015-03-31 11:53:07