Update Attachment in Richtext Fields in SharePoint

  1. ‪#‎  
  2. Add‬ SharePoint PowerShell Snapin which adds SharePoint specific cmdlets  
  3.   
  4. Add - PSSnapin Microsoft.SharePoint.PowerShell - EA SilentlyContinue  
  5.   
  6. ‪#‎ Variables‬ that we are going to use  
  7. for list editing  
  8. $webURL = "someurl/"  
  9. $listName = "Demo List"  
  10.   
  11. ‪#‎  
  12. Get‬ the SPWeb object and save it to a variable  
  13. $web = Get - SPWeb $webURL  
  14.  
  15. # Get the SPList object to retrieve the "Demo List"  
  16. $list = $web.Lists[$listName]  
  17.  
  18. # Get all items in this list and save them to a variable  
  19. $items = $list.items  
  20.   
  21. ‪#‎ Go‬ through all items  
  22. foreach($item in $items) {‪#‎  
  23.     If‬ the "Title"  
  24.     column value equals "My first item!"  
  25.     do something with it  
  26.     if ($item["Title"] - eq "test1") {‪#‎  
  27.         Change‬ the value of the "Title"  
  28.         column  
  29.         $item["Remarks"] = "My first edited item! test1"  
  30.   
  31.         ‪#‎  
  32.         Update‬ the item  
  33.         $item.Update()  
  34.     }