我有这段代码可以在 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。