私はこの質問を以前に一度聞いたことがありますが、少し間違いがありました。もう一度:Powershellを使用したフォルダ構造からチームサイトへ
私はPowershellを使用してSPOのチームサイトのドキュメントライブラリに自分のPC上にあるフォルダのフォルダ構造を統合しようとしています。
$Folder = "D:\Skripte\04_Manuelle_Ausfuehrung\Office 365\CreateSite\Teamseiten"
$DocLibName = "Dokumente"
#Retrieve list
$List = $ctx.Web.Lists.GetByTitle($DocLibName)
$ctx.Load($List)
$ctx.ExecuteQuery()
#Upload file
Get-ChildItem -Recurse $Folder |
Foreach-Object {
$FileStream = New-Object IO.FileStream($_.FullName,[System.IO.FileMode]::Open)
$FileCreationInfo = New-Object Microsoft.SharePoint.Client.FileCreationInformation
$FileCreationInfo.Overwrite = $true
$FileCreationInfo.ContentStream = $FileStream
$FileCreationInfo.URL = $_
$Upload = $List.RootFolder.Files.Add($FileCreationInfo)
$ctx.Load($Upload)
$ctx.ExecuteQuery()
Write-Host $_
}
が、私は「書き込みホスト」とフォルダを表示することができていると私はまた、フォルダの権限を持っているが、私はそれをアップロードすることはできません:私は、チームサイトを作成した後、私は次のスクリプトを使用します。各フォルダとサブフォルダに次のエラーメッセージが表示されます。
New-Object: Exception calling ".ctor" with 2 argument (s): "Access to the path" D:\scripts\04_Manuelle_Ausfuehrung\Office 365\Createsite\Team Sites\01_Bekanntmachung and guidelines "
was denied."
In D:\scripts\04_Manuelle_Ausfuehrung\Office 365\Createsite\SPOCreateSite.ps1: 84 mark: 15
+ $FileStream = New-Object IO.FileStream ($_.FullName, [System.IO.FileMode] :: Open)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
+ Category Info: InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId: ConstructorInvokedThrowException, Microsoft.PowerShell.Commands.NewObjectCommand
Exception calling "executeQuery" with 0 Argument (s): "parameters.Content, parameters.ContentStream
Parameter name: The specified value is not supported parameters.ContentStream parameters for parameters.Content ".
In D:\scripts\04_Manuelle_Ausfuehrung\Office 365\Createsite\SPOCreateSite.ps1: 91 mark: 1
+ $Ctx.ExecuteQuery()
+ ~~~~~~~~~~~~~~~~~~~
+ Category Info: NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId: ServerException
私は誰かが間違っていると教えてくれることを願っています。 SharePoint Onlineの(.ContentStreamパラメータを省略)にフォルダを追加する方法
事前のおかげで、多くの挨拶
アンディ
'Test-Path $ _。FullName'は動作していますか? –
いいえ動作していません.. Test-Path:引数がNULLなので、引数 "Path"にバインドすることはできません。ラインで :1文字:11 +テストパス$ _フルネーム + ~~~~~~~~~~~ + CategoryInfo:InvalidData:(:) [テストパス]、ParameterBindingValidationException + FullyQualifiedErrorId。 ParameterArgumentValidationErrorNullNotAllowed、Microsoft.PowerShell.Commands.TestPathCommand – andyohn
単なるフォルダの場合、.ContentStreamを追加する理由はありますか? – grisha