错误阅读Outlook日历约会与C#程序
我得到一个C#Windows应用程序尝试读取Outlook日历信息的错误 但以前工作但我认为在服务器端发生的安全相关的变化,我可以看到,也不会被告知。错误阅读Outlook日历约会与C#程序
我使用Outlook 2010(v14.0.3129.5000)
有错误我得到的是:
System.Runtime.InteropServices.COMException(0x80004005的):未指定的错误(从HRESULT异常:
:0X80004005(E_FAIL))if (oAppt.Body != null)
尝试读取预约体时出现的错误10
我可以没有问题
Microsoft.Office.Interop.Outlook.RecurrencePattern recurrencePattern;
Microsoft.Office.Interop.Outlook.NameSpace oNS;
Microsoft.Office.Interop.Outlook.MAPIFolder oCalendar;
Microsoft.Office.Interop.Outlook.Items oItems;
Microsoft.Office.Interop.Outlook.AppointmentItem oAppt;
Microsoft.Office.Interop.Outlook.Application _OutlookApplication;
try
{
_OutlookApplication = new Microsoft.Office.Interop.Outlook.Application();
oNS = _OutlookApplication.GetNamespace("MAPI");
// Get the Calendar folder.
oCalendar = oNS.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar);
oCalendar.Items.IncludeRecurrences = true;
// Get the Items (Appointments) collection from the Calendar folder.
oItems = oCalendar.Items;
for (Int32 x = 1; x <= oItems.Count; x++)
{
//Need to change how we are getting the appointment
//Apparently Outlook will return non-appointments in the calendar feed
try
{
oAppt = (Microsoft.Office.Interop.Outlook.AppointmentItem)oItems[x];
Console.WriteLine(oAppt.Subject);
}
catch (Exception)
{
continue;
}
if (oAppt.Body != null)
Console.WriteLine(" Calendar Body:" + oAppt.Body.ToString());
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message.ToString());
}
}
通过堆栈跟踪我看到下面的错误
at Microsoft.Office.Interop.Outlook._AppointmentItem.get_Body()
任何人都可以用,为什么这个错误发生的帮助,如果有任何挖掘准备其他日历属性我可以执行什么工作?
我能够与我们的某个管理员联系,发现这个特定问题是由推送到我们计算机的组策略引起的。
错误并没有把你指向这个方向,但是这是问题
您是否通过更改组策略来更正?我有同样的错误。我尝试了其他版本的Interop,但没有改变。为什么我们不能得到描述事件,如果我们有所有其他属性? – forX 2014-12-15 20:52:40
不知道他们授予了哪些权限,但他们确实为我的帐户提供了额外的额外功能,并且这又开始重新工作 – user3693281 2014-12-17 22:18:47
我们是否知道需要更改哪些设置? – 2016-05-13 12:44:12
您可以使用EWS,这帮助我(仍然工作)http://stackoverflow.com/questions/3304157/error-when- i-try-to-read-update-the-body-of-a-task-via-ews-managed-api-you-m – forX 2016-12-16 18:57:19