1

我正在尝试获取我的 Office 365 SharePoint 网站文档库中的文件名列表。

我正在使用以下代码List.asmx使用 Visual Studio 2010 访问服务。

ServiceReference1.ListsSoapClient ws = new ServiceReference1.ListsSoapClient();
ws.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential("USERNAME", "PASSWORD", "sharepoint");            
ws.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
ws.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://XYZ.sharepoint.com/_vti_bin/lists.asmx");
XElement li = ws.GetListCollection();

ws.GetListCollection()此代码在执行功能时给了我以下错误:

The HTTP request was forbidden with client authentication scheme 'Ntlm'. 

任何人都可以帮助我吗?SharePoint 网站访问权限是否有任何问题,或者我在代码部分或某些配置内容中遗漏了什么?

4

0 回答 0