プログラムでライブラリからドキュメントをダウンロードしようとするとエラー401を取得する

sharepoint.stackexchange https://sharepoint.stackexchange.com//questions/37622

質問

このコードで文書をダウンロードしようとしています。

 using (Impersonator impersonator = new Impersonator())
 {
     siteURL += "?NoRedirect=true";
     System.Net.WebClient _WebClient = new System.Net.WebClient();
     // Downloads the resource with the specified URI to a local file.
     _WebClient.DownloadFile(siteURL, saveName);
 }
.

しかし、私はエラー401のunotaurizedアクセスを取得します。あなたはそれが来るところのアイデアを持っていますか? ありがとう

役に立ちましたか?

解決

追加を試してみてください:

_WebClient.Credentials = CredentialCache.DefaultCredentials;
.

ライセンス: CC-BY-SA帰属
所属していません sharepoint.stackexchange
scroll top