I must find a script or metod how to get a attachment from the Sharepont lists.

Its Beter to get Attachment and get a title of the image from one field and save the Attachmend. Please Help me. Its Sharepoint 2013

  • Please be clear what you want? Commented Sep 2, 2014 at 6:16
  • I say Clearly I want to get all atachment from the list to any folfder on the disk.
    – Grzegorz Z
    Commented Sep 2, 2014 at 6:22
  • you mean specific list item ? or from all the items in the list? Commented Sep 2, 2014 at 6:22
  • From all the items in the list. I found out this script: bhatiaashish.blogspot.com/2012/08/… I will try him What You think about this script ?
    – Grzegorz Z
    Commented Sep 2, 2014 at 6:29
  • 1
    yeh you can try that Commented Sep 2, 2014 at 6:32

2 Answers 2


The simplest way it is to open your site through SharePoint Designer navigate to All files -> Lists -> YourList -> Attachments (this folder contains all attachments, that stored in current list)

Another way is required little programming skills. You need to use some special script, as example you can take the following script:

 if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {
    Add-PSSnapin "Microsoft.SharePoint.PowerShell"

  $webUrl  = "Url"    
  $library = "ListName"   

  #Local Folder to dump files
  $tempLocation = "FolderPath"     

  $s = new-object Microsoft.SharePoint.SPSite($webUrl)    
  $w = $s.OpenWeb()         
  $l = $w.Lists[$library]    
  $items = $l.Items
  foreach ($listItem in $items)
        Write-Host "Content: " $listItem.ID 
        $destinationfolder = $tempLocation + "\" + $listItem.ID          
          if (!(Test-Path -path $destinationfolder))        
             $dest = New-Item $destinationfolder -type directory          

          foreach ($attachment in $listItem.Attachments)    
                $file  = $w.GetFile($listItem.Attachments.UrlPrefix + $attachment)        
                $bytes = $file.OpenBinary()                
                $path  = $destinationfolder + "\" + $attachment
                Write "Saving $path" 
                $fs = new-object System.IO.FileStream($path, "OpenOrCreate") 
                $fs.Write($bytes, 0 , $bytes.Length)    

For more details about this script method, please visit the following link

  • And how copy a Files and Catalog from Designer?
    – Grzegorz Z
    Commented Sep 2, 2014 at 8:11
  • 1
    Sorry, I forgot that copy-paste works only in Sharepoint Designer. As workaround you can click copy and paste in document library after that you can open document library through Explorer.
    – Roman
    Commented Sep 2, 2014 at 12:42
  • I menaged by Powershel, But Thanks after that info too !!! :)
    – Grzegorz Z
    Commented Sep 2, 2014 at 13:15

Map to the list as a network place. This will group all list item attachments in folders by their ID. At this point you will be able to easily and quickly move attachments to other file share locations or a SP document library.

  • I get the "Access denied, add the site to your Trusted Sites list" message, even though it is already there. I can map Libraries from that site, but not Lists
    – golimar
    Commented Nov 29, 2019 at 7:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.