1
我希望能够将共享联系人的指定日历发送到Excel。我可以从我的日历发送信息,但无法发送共享联系人的日历。这是我自己的日历中的代码:c#如何将共享的Outlook日历导出为Excel?
private void ButtonClick()
{
//open excel with 1 sheet
Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
excelApp.Visible = true;
Microsoft.Office.Interop.Excel.Workbook newWorkbook = excelApp.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
Microsoft.Office.Interop.Excel.Worksheet caldendarWorksheet = newWorkbook.Sheets.Add(Type.Missing,Type.Missing,1,Type.Missing) as Microsoft.Office.Interop.Excel.Worksheet;
caldendarWorksheet.Name = "CalendarView";
//accesses outlook to get the calendar
Microsoft.Office.Interop.Outlook.Application ol = null;
Microsoft.Office.Interop.Outlook.MAPIFolder blab = Globals.ThisAddIn.Application.Session.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar);
Microsoft.Office.Interop.Outlook.Items ItemGet = blab.Items.Restrict("[MessageClass]='IPM.Appointment'");
Microsoft.Office.Interop.Outlook.Items ItemGet = blab.Items;
int iNumContacts = ItemGet.Count;
if (iNumContacts != 0)
{
// the index i is 1-iNumContacts,
int i = 1;
Microsoft.Office.Interop.Outlook.AppointmentItem c = ItemGet[i] as Microsoft.Office.Interop.Outlook.AppointmentItem;
}
}
这只适用于我的个人日历。
我该怎么做呢? – Sam
这是如何解决这个问题的?正是你在那里做了什么.. = /我仍然无法获得共享日历! = / – renanlf