0

My Powershell Script is :

$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null) { Add-PSSnapin Microsoft.SharePoint.Powershell }

$web = Get-SPWeb http://intranet/Operations/RestrictedArea
$listTODO = $web.Lists["ToDo"]

$Fund = get-spweb http://intranet/sites/clients
$listFunds = $Fund.Lists["Client"]
$allFunds = $listFunds.GetItems($listFunds.Views["All Clients"])

$listTarget = $web.Lists["CheckList"]
$listTarget.Title

foreach($itemTODO in $listTODO.Items | Where {$_["Frequency"] -eq "Daily"})
{
    if ($itemTODO["Fund"] -ne $null) 
    {
        $commonValue = $itemTODO["Fund"].Tostring().Split("|")[0]

        $itemsFunds = $allFunds | Where-Object { $_["Fund"].Tostring().Split(",")[1].ToString().Trim() -eq $commonValue}

        $newItem = $listTarget.Items.Add();
        $newItem["Fund Name"] = $commonValue
        $newItem["Task Name"] = $itemTODO["Fund"].Label + " -> " + $itemTODO["Title"]
        $newItem["Link"] = $itemTODO["Link"]
        $newItem["Link 2"] = $itemTODO["Link 2"]
        $newItem["Details"] = $itemTODO["Details"]
        $newItem["Category"]= $itemTODO["Category"]
        $newItem["StartDate"] = $today.ToShortDateString()
        $newItem["DueDate"] = $today.ToShortDateString()

        $newItem.Update()
    }
}

My Problem that i have a People Picker Column "Concerned" with Multiple selection. I want when copying this item in the Target list, every person selected get his own task in different row.

  • Please provide information about these people picker fields in source and target lists - are multiple values allowed in both fields? – Kristaps Vilerts Nov 16 '18 at 12:39
  • Yes it's multiple values – Jihen Nov 19 '18 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.