手作りエラー使用時のユー
-
22-10-2019 - |
質問
私はこのエラーは以下のライン
例外は呼び出し"作成"を"4"に引数:"価値はできません nullになります。パラメータ名parentFolder"で x:\Common\ユー\MoveFiles2DocSet.ps1:29charのもの91 +$newDocumentSet= [Microsoft.ます。DocumentManagement.DocumentSets.DocumentSet]::作成 <<<< ($docLib.RootFo lder,$DocSet,$cType.Id$docsetProperties) +CategoryInfo:NotSpecified:(:)[], MethodInvocationException +FullyQualifiedErrorId:DotNetMethodException
$newDocumentSet = [Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet]::Create($docLib.RootFolder,$DocSet,$cType.Id,$docsetProperties)
$siteURL="http://intranet.colgate.com/sites/blazingWhite"
$docLib = "NewProduct"
$site=Get-SPSite $siteURL
$web=$site.RootWeb
$collFiles=$web.GetFolder($docLib).Files
$count=$collFiles.Count
while($count -ne 0)
{
$item = $collFiles[$count-1].Item
## Create document set if it does not exists
$DocSet = $item["CounterParty"]
$DocSetURL = $siteURL + "/" + $docLib + "/" + $DocSet
$docLibURL = $siteURL + "/" + $docLib
[Microsoft.SharePoint.SPFolder]$targetFolder = $web.GetFolder($DocSetURL)
[Microsoft.SharePoint.SPFolder]$doclibFolder = $web.GetFolder($docLibURL)
Write-Host ""
Write-Host $DocSet
Write-Host $targetFolder
Write-Host $doclibFolder
if (-not $targetFolder.Exists)
{ # Create Doc Set
# Get Document Set Content Type from list
$cType = $web.ContentTypes["Document Set"]
# Create Document Set Properties Hashtable
[Hashtable]$docsetProperties = @{"Title"=$DocSet}
$docsetProperties = @{"Description"=$DocSet}
$docsetProperties = @{"CounterParty"=$DocSet}
Write-Host $cType.Id
Write-Host $docsetProperties
Write-Host ""
# Create new Document Set
$newDocumentSet = [Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet]::Create($doclibFolder,$DocSet,$cType.Id,$docsetProperties)
Write-Host "Document set created " $newDocumentSet
if($newDocumentSet.Exists)
{
# changing folder type to Document Set type
$newDocumentSet.Item["ContentTypeId"] = $cType.Id
$newDocumentSet.Item["HTML File Type"] = "SharePoint.DocumentSet"
$newDocumentSet.Item.Update()
}
}
# move file(s) to the document set
Write-Host "$DocSet is the doc set. $collFiles[$count-1].Name is name"
$collFiles[$count-1].MoveTo($siteURL + "/" + $docLib + "/" + $DocSet + "/" + $collFiles[$count-1].Name, $true)
$count--
}
#dispose:
$web.Dispose();
$site.Dispose();
編集:
上記のコードは作業以外のインターネットのようになフォルダの代わりにブルーのdocフレーバの設定アイコンで表します。誰でもできますかを明らかにするこてください。
解決
見るだけで自のコードです。
Create($docLib.RootFolder,$DocSet,$cType.Id,$docsetProperties)
や $docLib
はん。
$docLib = "NewProduct"
っこう
Create($targetFolder,$DocSet,$cType.Id,$docsetProperties)
以降
[Microsoft.SharePoint.SPFolder]$targetFolder = $web.GetFolder($DocSetURL)
他のヒント
私のような遅いこの特定の者が研究を自分の問題ドキュメントのセットとして登場する簡単なフォルダまたこのブログエントリ http://aknauer.blogspot.com/2011/06/document-sets-und-powershell.html )に含まれるこの貴重なナゲット:
"も重要であることを選択しコンテンツ種類$cTypeから 収集のリストのないコレクション。なだけでなく、文書を新規に設定フォルダが作成されます。"
に転向しましたコンテンツタイプから担当ウェブコレクション(としてマラーストラを行っていたのリストの収集(アンドレアスと)と私の問題とおり決議しております。-