Comments? Questions?

Have a look at my GitHub SharePointOnline-ScriptSamples, where you can find this SharePoint script and 280 others!

You can find all my repositories at PowershellScripts @ GitHub

 

Powershell script retrieves all attachments from a SharePoint list (not library) and exports the results to a csv file.

 

The csv file contains itemID, item title, the name of the file and its size. Each file is listed in a separate line (so items with several attachments will be listed several times, once per each file).  Sample results:

 

 

In order to use the script, you need to modify the downloaded file. At the bottom you will find the following lines:

 

PowerShell
Edit|Remove
# Paths to SDK. Please verify location on your computer. 
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"  
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"  
 
#Please enter your data 
$Username = "ana@etr56.onmicrosoft.com" 
$Url = "https://etr56.sharepoint.com" 
$ListTitle = "attatest" 
$CSVPath = "C:\Users\Public\attachmentsreport.csv"