を使用して他のために、SharePointから多くのファイルをコピー:私は別の1つのSharePointのリストから文書をコピーしようとしているメートルのPowerShell
これは私のコードです:
*************************************************
$source= "\\...\s1"
$destination = "\\..\s2"
foreach ($result in $result)
{ copy-item -path $source -dest $destination}
*************************************************
-$result
は、すべての文書の一覧です私は、Webサービスを使用して得た、それがタイプだ
-$source
と$destination
がUNCのSystem.Arrayある2つのSharePoint
エラーが
"パスが見つかりません\ ... \ s1system.xml.Xml.XmlElement"
PSされています。私は、サーバー・マシンを使用していないM、それだけで、クライアントよここで
は私のコードはおそらく、あなたが持っている問題は、変換の問題の結果である
*****************************************************
{
param (
[String]$Value,
[String]$Field,
[String]$RowLimit = "0",
[String]$Operator = "Contains",
[String]$WebURL = "https://.................../wer",
[String]$ListName = "Main documents",
[String]$ViewName,
[Switch]$Recurse
)
$ScriptDirectory = split-path $MyInvocation.MyCommand.Definition
$dllPath = "P:\SamlCookieAuth.dll" -f $ScriptDirectory
[void][System.Reflection.Assembly]::LoadFrom($dllPath)
$queryOptionsValue = ''
if ($Recurse)
{
$queryOptionsValue = '<ViewAttributes Scope="RecursiveAll"/>'
}
$WSUri = $WebURL + "/_vti_bin/Lists.asmx?wsdl"
$listsWebServiceReference = New-WebServiceProxy -Uri $WSUri -UseDefaultCredential
$listsWebServiceReference.Url = $webURL + "/_vti_bin/lists.asmx"
[System.Uri]$CookieUri = $WebURL
$listsWebServiceReference.CookieContainer = [ST.SamlCookieAuth.SamlCookieManager]::GetAuthenticatedCookiesContainer($CookieUri.AbsoluteUri, 0, 0)
[System.Xml.XmlDocument]$xmlDoc = New-Object -TypeName System.Xml.XmlDocument
[System.Xml.XmlElement]$queryOptions =$xmlDoc.CreateElement("QueryOptions")
$queryOptions.InnerXml = $queryOptionsValue
if ($PSBoundParameters.Keys.Contains("Value"))
{
[System.Xml.XmlElement]$query = $xmlDoc.CreateElement("Query")
$queryValue = "<Where><$Operator><FieldRef Name='$Field'/><Value Type='Text'>$Value</Value></$Operator></Where>"
$query.InnerXml = $queryValue
$result=$listsWebServiceReference.GetListItems($listName, $viewName, $query, $null, $rowLimit, $queryOptions, $null).data.row
}
else
{
$result=$listsWebServiceReference.GetListItems($listName, $viewName, $null, $null, $rowLimit, $queryOptions, $null).data.row
}
$destDirectory = "\\.............\TER\Main Documents"
foreach ($resul in $result)
{Copy-Item -path $resul -destination $destDirectory }
}
'foreachの($ $結果につながります)'私には疑わしい。私は 'foreach($ doc in $ result)'を試してみたいと思います。また、この配列の内容を調べる必要があります。完全なオブジェクトの代わりに 'copy-item'に渡すためにプロパティにアクセスする必要があるかもしれません。 – Filburt
これはlisteNameですが、new-webserviceproxyというコマンドを使用しています。ows_linkFileName、ows_modified ..... – ajar