使用Powershell将文件上载到Sharepoint时出现突发错误

时间:2014-05-28 08:33:20

标签: powershell sharepoint

我使用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()
}

这里有什么不对?我错过了什么?

0 个答案:

没有答案