Interop Error WorkBook.Open?

时间:2011-11-08 23:46:57

标签: c# excel excel-interop office-automation

我有这个代码在SharePoint上打开一个WorkBook,它在本地服务器上运行时效果很好但是当我远程访问时无法访问该sharepoint站点EX:

  

(本地=成功)(MachineA到SharePoint =失败)

SPSecurity.RunWithElevatedPrivileges(delegate()
{
    using (SPSite site = SPContext.Current.Site)
    {
       using (SPWeb web = SPContext.Current.Web)
       {    
          Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
          var wb = app.Workbooks;
          wb.Application.Visible = false;
          string opl = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
          //The issue happens here                           
          var file = wb.Open(fileToOpen.ToString(), Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing);
       }
    }
}

我的环境是: SharePoint 2010 Windows Server 2008 Interop 14

有什么想法吗?我尝试将网络服务帐户添加到dcomcnfg中的Excel应用程序,但无论如何我使用的是使用TEST \ administrator帐户的RunWithElevatedPrivilage。

0 个答案:

没有答案