string remoteUri = "http://www.contoso.com/library/homepage/images/";
string fileName = "ms-banner.gif", myStringWebResource = null;
// Create a new WebClient instance.
WebClient myWebClient = new WebClient();
// Concatenate the domain with the Web resource filename.
myStringWebResource = remoteUri + fileName;
Console.WriteLine("Downloading File \"{0}\" from \"{1}\" .......\n\n", fileName, myStringWebResource);
// Download the Web resource and save it into the current filesystem folder.
myWebClient.DownloadFile(myStringWebResource,fileName);
Console.WriteLine("Successfully Downloaded File \"{0}\" from \"{1}\"", fileName, myStringWebResource);
Console.WriteLine("\nDownloaded file saved in the following file system folder:\n\t" + Application.StartupPath);
我'使用從MSDN Web Site下載文件從SharePoint 365
但我已經越過錯誤來驗證碼:403禁止
有人可以幫我把這個工作?
爲什麼驗證類型是您要下載的文件?你有沒有嘗試設置'myWebClient.Credentials =新的NetworkCredential(「用戶」,「通過」);'基本身份驗證? – Nate
嘗試憑證後發生同樣的錯誤! – Nevesito