Skip to main content
deleted 881 characters in body
Source Link
Jihen
  • 513
  • 3
  • 22

In this script, i want to to copy an item from list to another list. This item contain an attachments. How i can add the attachments to my code

$web = Get-SPWeb http://intranet/sales/
$listSales = $web.Lists["Sales Projects"]


$Prospect = Get-SPWeb http://intranet/CAC/
$listProspect = $Prospect.Lists["Clients"]


foreach ($item in $listSales.Items | Where {$_["Status"] -eq "Confirmed" -and $_["isDone"] -eq $null}) { 
    
    Write-Host $item.Title
    
      $newItem = $listProspect.Items.Add();
      
      
      $newItem["Client's Name"] = $item["Client Name"]
      $newItem["Initiator"] = $item["Initiator"]
      $newItem["Referral Route"] = $item["Introduction Channel"]
      $newItem["Contact Details of Initiator"] = $item["Contact Details"]
      $newItem["Corporate Form"] = $item["Corporate Form"]
      $newItem["Investment Vehicle"] = $item["Investment Vehicle"]
      $newItem["Structure Type"] = $item["Type of Prospect"]
      $newItem["Branch"] = $item["Branch"]
      $newItem["Product Regulation"] = $item["Product Regulation"]
      $newItem["Target launch date"] = $item["Expected launch date"]
      $newItem["Services in scope for MDO"] = $item["Service Type"]
      $newItem["Other Services"] = $item["Other Services"]
      $newItem["Comments"] = $item["Comments"]
      $newItem["AUM Estimated"] = $item["Estimated AUM (in millions) at launch"]
      $newItem["Depositary"] = $item["Custodian / Depository"]
   
      $newItem.Update()

   
      $item["isDone"]="Done"
      $item.Update()
}

}

In this script, i want to to copy an item from list to another list. This item contain an attachments. How i can add the attachments to my code

$web = Get-SPWeb http://intranet/sales/
$listSales = $web.Lists["Sales Projects"]


$Prospect = Get-SPWeb http://intranet/CAC/
$listProspect = $Prospect.Lists["Clients"]


foreach ($item in $listSales.Items | Where {$_["Status"] -eq "Confirmed" -and $_["isDone"] -eq $null}) { 
    
    Write-Host $item.Title
    
      $newItem = $listProspect.Items.Add();
      
      
      $newItem["Client's Name"] = $item["Client Name"]
      $newItem["Initiator"] = $item["Initiator"]
      $newItem["Referral Route"] = $item["Introduction Channel"]
      $newItem["Contact Details of Initiator"] = $item["Contact Details"]
      $newItem["Corporate Form"] = $item["Corporate Form"]
      $newItem["Investment Vehicle"] = $item["Investment Vehicle"]
      $newItem["Structure Type"] = $item["Type of Prospect"]
      $newItem["Branch"] = $item["Branch"]
      $newItem["Product Regulation"] = $item["Product Regulation"]
      $newItem["Target launch date"] = $item["Expected launch date"]
      $newItem["Services in scope for MDO"] = $item["Service Type"]
      $newItem["Other Services"] = $item["Other Services"]
      $newItem["Comments"] = $item["Comments"]
      $newItem["AUM Estimated"] = $item["Estimated AUM (in millions) at launch"]
      $newItem["Depositary"] = $item["Custodian / Depository"]
   
      $newItem.Update()

   
      $item["isDone"]="Done"
      $item.Update()

}

In this script, i want to to copy an item from list to another list. This item contain an attachments. How i can add the attachments to my code

$web = Get-SPWeb http://intranet/sales/
$listSales = $web.Lists["Sales Projects"]


$Prospect = Get-SPWeb http://intranet/CAC/
$listProspect = $Prospect.Lists["Clients"]


foreach ($item in $listSales.Items | Where {$_["Status"] -eq "Confirmed" -and $_["isDone"] -eq $null}) { 
    
    Write-Host $item.Title
    
      $newItem = $listProspect.Items.Add();
      
      
      $newItem["Client's Name"] = $item["Client Name"]
      $newItem["Initiator"] = $item["Initiator"]
 
   
      $newItem.Update()

   
      $item["isDone"]="Done"
      $item.Update()
}
Source Link
Jihen
  • 513
  • 3
  • 22

Copy attachments from list to another list

In this script, i want to to copy an item from list to another list. This item contain an attachments. How i can add the attachments to my code

$web = Get-SPWeb http://intranet/sales/
$listSales = $web.Lists["Sales Projects"]


$Prospect = Get-SPWeb http://intranet/CAC/
$listProspect = $Prospect.Lists["Clients"]


foreach ($item in $listSales.Items | Where {$_["Status"] -eq "Confirmed" -and $_["isDone"] -eq $null}) { 
    
    Write-Host $item.Title
    
      $newItem = $listProspect.Items.Add();
      
      
      $newItem["Client's Name"] = $item["Client Name"]
      $newItem["Initiator"] = $item["Initiator"]
      $newItem["Referral Route"] = $item["Introduction Channel"]
      $newItem["Contact Details of Initiator"] = $item["Contact Details"]
      $newItem["Corporate Form"] = $item["Corporate Form"]
      $newItem["Investment Vehicle"] = $item["Investment Vehicle"]
      $newItem["Structure Type"] = $item["Type of Prospect"]
      $newItem["Branch"] = $item["Branch"]
      $newItem["Product Regulation"] = $item["Product Regulation"]
      $newItem["Target launch date"] = $item["Expected launch date"]
      $newItem["Services in scope for MDO"] = $item["Service Type"]
      $newItem["Other Services"] = $item["Other Services"]
      $newItem["Comments"] = $item["Comments"]
      $newItem["AUM Estimated"] = $item["Estimated AUM (in millions) at launch"]
      $newItem["Depositary"] = $item["Custodian / Depository"]
   
      $newItem.Update()

   
      $item["isDone"]="Done"
      $item.Update()

}