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 サイトのアクセス許可に問題がありますか、それともコード部分または構成に何か不足していますか?