我使用Powershell将图像(< 100kb)上传到SharePoint文档库。前30-40个文件完美上传,但突然之间我收到了这条消息:
Exception calling "UploadFile" with "3" argument(s): "An exception occurred during a WebClient request." At D:\SP01\Scripts\E_Zeitkonto\PSURLCapture\PSURLCapture.ps1:153 char:26
+ $WebClient.UploadFile <<<< ($UploadFullPath, "PUT", $LocalPath)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
上传文件的代码是:
Function UploadToSPPictureLib($LocalPath, $spDocLibPath)
{
$UploadFullPath = $spDocLibPath + "/" + $(split-path -leaf $LocalPath)
$WebClient = new-object System.Net.WebClient
$WebClient.Credentials = [System.Net.CredentialCache]::DefaultCredentials
$WebClient.UploadFile($UploadFullPath, "PUT", $LocalPath)
$WebClient.Dispose()
}
这里有什么不对?我错过了什么?