我正在尝试使用下载 Office 365 SharePoint 库中存在的项目,WebcClient.DownloadFile()
但出现此异常:
例外 :
The remote server returned an error: (403) Forbidden.
示例代码:
NetworkCredential credential = new NetworkCredential("username", "password", "aaa.onmicrosoft.com");
WebClient webClient = new WebClient();
webClient.Credentials = credential;
webClient.DownloadFile(@"https://aaa.sharepoint.com/testDoc/test.pdf", @"c:/test.pdf");