In this blog, you'll learn how to use the PnP PowerShell to download the attachments from the specified list item.
Check this link for downloading multiple files from the given URL using the same PnP PowerShell.
Step 1
First, we have to get the list item from SharePoint.
First, we have to get the list item from SharePoint.
- $listitem = Get-PnPListItem -List <ListName> -Id <Item ID>
Get the attachment for the list item.
- $attachments = ForEach-Object{Get-PnPProperty -ClientObject $listitem -Property "AttachmentFiles"}
Download the retrieved attachments from the following path.
- $attachments | ForEach-Object { Get-PnPFile -Url $_.ServerRelativeUrl -FileName $_.FileName -Path "E:\Downloads\" -AsFile }
- $cred = Get-Credential
- Connect-PnPOnline -Url https://ktskumartenant.sharepoint.com/sites/dev -Credential $cred
- $listitem = Get-PnPListItem -List Employee -Id 2
- $attachments = ForEach-Object{Get-PnPProperty -ClientObject $listitem -Property "AttachmentFiles"}
- $attachments | ForEach-Object { Get-PnPFile -Url $_.ServerRelativeUrl -FileName $_.FileName -Path "E:\ktskumar\Documents" -AsFile }

Rod MerrittPosted Dec 6, 2018, 5:49 PM
How do you add an attachment to sharepoint list item