我正在尝试访问我的SharePoint(例如: https ://examplesharepoint.com)网络服务以获取一些信息,但在代码中它将提供
我的网络配置:
<security mode="Transport">
<transport clientCredentialType="Ntlm"/>
</security>
我的代码会抛出错误
listService.Endpoint.Address =
new System.ServiceModel.EndpointAddress(scolurl + "/_vti_bin/Lists.asmx");
if (_userName != null)
{
listService.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential(_userName, _passWord, _domain);
//listService.ClientCredentials.UserName.UserName = _userName;
//listService.ClientCredentials.UserName.Password = _userName;
}
else
{
listService.ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
}
XmlDocument doc = new XmlDocument();
doc.LoadXml(query);
XmlNode queryNode = doc.SelectSingleNode("//Query");
XmlNode viewNode = doc.SelectSingleNode("//ViewFields");
XmlNode optionNode = doc.SelectSingleNode("//QueryOptions");
try
{
XmlNode retNode = listService.GetListItems("My Project", null, queryNode, viewNode, null, optionNode, null);
它将在最后一行引发异常&#34; HTTP请求被禁止使用客户端身份验证方案&#39; Ntlm&#39;&#34;任何建议请
注意:我正在使用SharePoint最新版本,并且它与早期版本的SharePoint一起运行