我试图获取SharePoint 2013文档库中的文件版本。
图书馆的网址是:
https://sps.abc.xyz.com/sites/map/DRC
我使用以下课程:
public class VersionFinder
{
DRCCrawler.Versions.Versions versions = new DRCCrawler.Versions.Versions();
public VersionFinder()
{
versions.UseDefaultCredentials = true;
versions.Url = "https://sps.abc.xyz.com/sites/map/DRC/_vti_bin/versions.asmx";
}
public XmlNode GetVersions(string filename)
{
try
{
XmlNode ndDRCs = versions.GetVersions(filename);
return ndDRCs;
}
catch (SoapException ex)
{
throw new Exception("Error getting DRC.");
}
}
}
我按如下方式致电GetVersions()
:
public void versionFinderTest()
{
string filename = "https://sps.abc.xyz.com/sites/map/DRC/abcdefg.xlsm";
VersionFinder vf = new VersionFinder();
XmlNode node = vf.GetVersions(filename);
}
运行此操作时,versions.GetVersions()
中的VersionFinder.GetVersions()
网络服务调用会返回以下错误:
An unhandled exception of type 'System.Net.WebException' occurred in System.Web.Services.dll
Additional information: The request failed with HTTP status 404: Not Found.
但是当我实际点击超链接中的filename
网址时,该文件会成功打开。因此,版本服务使用的filename
网址是否存在问题?或者可能是我如何初始化Versions服务?