We have a requirement for bulk workflow approval. Where we need to add items(with or without children) similar to this image,
Following this article, https://www.sitecorenutsbolts.net/2015/12/14/Multi-Item-Publish-with-Sitecore-Powershell-Extensions/, I created a power shell module named "BulkApproval" as below,
and when I click on Start new batch I was able to create a directory in the Data folder, now I am not sure how to copy the selected items to the newly created folder.
How do I achieve this? Any guidance would be much helpful.
My script is as below,
$dataFolder = [Sitecore.Configuration.Settings]::DataFolder
$rootFolder = $dataFolder + "\buckets"
$selectedItem = Get-Item -path .
if($selectedItem -ne $null){
$selectedItems = @()
$newWorkflowName = Show-Input "Please provide a name for the new batch:" -MaxLength 20
if($newWorkflowName -ne $null -and $newWorkflowName -ne ""){
$selectedItems += $selectedItem
if($selectedItem.Children.Length -gt 0){
$includeChildrenPromptResult = Show-ModalDialog -Control "ConfirmChoice" -Parameters @{btn_0="Yes"; btn_1="No"; te="Include child items?"; cp="Create Batch and Add Item"} -Height 120 -Width 450
if($includeChildrenPromptResult -eq "btn_0"){
$allChildItems = Get-ChildItem -Path $selectedItem.Paths.FullPath -Recurse
$selectedItems += $allChildItems
}
}
}
#create a new directory here
$newWorkflowPath = $rootFolder+"\"+$newWorkflowName
Write-Host("$newWorkflowPath",$newWorkflowPath)
Write-Host("New Item",$newWorkflowPath)
New-Item -Path $newWorkflowPath -ItemType directory
ForEach ($item in $selectedItems) {
Copy-Item -Path $item.FullPath -Destination $newWorkflowPath
}
}