My program must verify this requirement :
Add Owner value from List A where Name (in list A) eq Name (in list B): Here i want to nested the first Foreach in the second one
Add-PSSnapin Microsoft.SharePoint.PowerShell
$web = get-spweb http://intranet/Operations/
$todolist = $web.Lists["ToDo"]
$checkList = $web.Lists["CheckList"]
$Fund = get-spweb http://sites/clients
$PersonsList = $Fund.Lists["Client Allocation"]
$today = Get-Date
foreach ($person in $PersonsList.Items | Where $_["Fund"] -eq "Agenda")
{
$checkListItem = $checkList.Items.Add()
$checkListItem["Assigned To"]= $Person["Risk Manager In charge"]
$checkListItem["Backup"] = $Person["Backup"]
$checkListItem.Update()
}
foreach ($task in $todolist.Items)
{
$checkListItem = $checkList.Items.Add()
$checkListItem["StartDate"] = $today.ToShortDateString()
$checkListItem["DueDate"] = $today.ToShortDateString()
$checkListItem["Fund Name"] = $task["Fund"].Tostring().Split("|")[0]
$checkListItem["Task Name"] = $task["Fund"].Label + " -> " + $task["Title"]
$checkListItem["Link"] = $task["Link"]
$checkListItem["Details"] = $task["Details"]
# I want To make here the result of the first Foreach where Title of the checklist eq to the Title Of fund List
# $checkListItem["Assigned To"] = $Fund.$PersonsList["Risk Manager In charge"]
$checkListItem.Update()
}