gpt4 book ai didi

sharepoint - 使用 32 位应用程序中的 SPSite 访问 64 位 SharePoint

转载 作者:行者123 更新时间:2023-12-01 10:16:45 27 4
gpt4 key购买 nike

我创建了一个以 32 位模式运行的批处理作业,因为它使用 32 位 COM 对象,这需要连接到 SharePoint 以更新列表。它在我的开发环境中工作,因为它是完整的 32 位。但在我的测试和生产环境中,我们使用 64 位 SharePoint,这是我从 SPSite 获得的:

System.IO.FileNotFoundException: 
The Web application at http://<my sp host>/ could not be found.
Verify that you have typed the URL correctly.
If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri req...

我就是这样做的

        using (SPSite site = new SPSite(_url))
{
using (SPWeb web = site.OpenWeb())
{
try
{
SPList list = web.Lists[new Guid(_listID)];
SPListItem item = list.GetItemById(id);
item[field] = value;
item.SystemUpdate(false);
}
catch (Exception x)
{
log.Error(x);
}
}
}

最佳答案

您只需在 64 位进程中运行批处理作业。问题是 SharePoint 有很多 COM 对象,这些对象在您的测试和生产环境中编译为 64 位。 SPSite 和 SPWeb 对象实际上包装了 COM 对象,这就是它们在您的 32 位进程中失败的原因。

一种解决方法是通过其 Web 服务而不是对象模型与 SharePoint 交互。

关于sharepoint - 使用 32 位应用程序中的 SPSite 访问 64 位 SharePoint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/250335/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com