Outlook Web服务调用

| 我正在尝试设置一个允许用户通过我的Web服务-
string subject, DateTime startTime, DateTime dueDate, string body, List<string> recipients, string owner
,然后创建一个
Task
。这在我的机器上工作正常,但是在Windows 2003上,我不断收到不同的错误。目前我正在-
Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
我正在使用一个具有电子邮件访问权限的帐户,并且该帐户已在该框中运行。我不确定这是否是最好的方法,但这就是我所得到的。而且请客气-我是.NET Web开发人员,无论如何都不是Outlook程序员。 我的代码看起来像这样-
Outlook task = new Outlook();
            TaskItem taskItem = (TaskItem)_application.CreateItem(OlItemType.olTaskItem);
            taskItem.Subject = subject;
            taskItem.StartDate = startTime;
            taskItem.DueDate = dueDate;
            taskItem.Body = body;
            foreach (string recipient in recipients)
            {
                taskItem.Recipients.Add(recipient);
            }            
            taskItem.Owner = owner;
            taskItem.Assign();
            task.EntryId = taskItem.EntryID;
            if (taskItem.Saved)
            {
                task.Successful = true;
            }
            return task;
    
已邀请:
类ID“ 4”是Outlook的Microsoft Office Interop程序集的类ID,它是Microsoft Office PIA的一部分。必须先在服务器上安装Microsoft Office PIA,然后才能使用.NET Office互操作性。 这是Office 2010的下载链接:http://www.microsoft.com/downloads/en/details.aspx?FamilyID=938fe8ad-583b-4bd7-a345-23250dc15855 如果使用的是Visual Studio 2010,则可以将PIA直接嵌入到自己的程序集中,而不是在服务器上安装PIA。为此,请在VS2010中的“ Microsoft.Office.Interop.Outlook \”引用的“属性”窗口中找到“嵌入的互操作类型”,并将其设置为“ true”。     
我想知道服务器上是否安装了其他版本的Office?我有一个Web应用程序,可在服务器上创建Word文档,而这一次服务器安装了Office 2003兼容性作为组策略的一部分。无论如何,发生了坏事,将其卸载,一切又变好了!     
众所周知,这些COM错误很难调试,我不知道那是什么意思。我可以提供的所有帮助方法是,一个我自己的代码来自一个现有项目,该项目确实在Outlook 2007中成功创建了任务。这是基于VSTO的应用程序。
            Dim task As Outlook.TaskItem = DirectCast(Application.CreateItem(Outlook.OlItemType.olTaskItem), Outlook.TaskItem)
            task.DueDate = Date.Parse(activity.ActDate)
            task.StartDate = task.DueDate
            task.Subject = String.Format(subjectText, activity.AppID)
            task.Body = String.Format(bodyText, activity.AppID, activity.FileNum, activity.AppID)
            task.ReminderTime = Now.AddMinutes(10)
            task.ReminderSet = True
            task.Categories = CATEGORY_TEST
            task.Save()
            task.Close(OlInspectorClose.olDiscard)
            Marshal.ReleaseComObject(task)
    

要回复问题请先登录注册