Is it Possible to Download All Attachments from Multiple Selected Items in a SharePoint List

Tristan 20 Reputation points
2024-10-18T17:12:52.51+00:00

We use a sharepoint list to record purchases on a company card. We track the status of the purchase in the list.

The person who processes the data will download the attached files (for each line item) to their local computer, process the data, and complete the workflow on sharepoint by changing the status of the line item. They would like to download all of the attachments associated with each line item, for all selected line items (i.e. unprocessed and specific card numbers), in a single click.

Is this possible? I don't see the option. After the line item status is changed to the completed status, the file on the local computer is no longer necessaryScreenshot 2024-10-18 114324

SharePoint in Microsoft 365

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,827 questions
SharePoint Workflow
SharePoint Workflow
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Workflow: An orchestrated and repeatable pattern of business activity, enabling data transformation, service provision, and information retrieval.
601 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ling Zhou_MSFT 18,100 Reputation points Microsoft Vendor
    2024-10-21T07:43:47.5633333+00:00

    Hi @Tristan,

    Thank you for posting in this community.

    First of all, I'm sorry that we don't have the option to download multiple attachments for multiple selected items in the list's interface. SharePoint's lists are important for recording data rather than saving files, so it weakens the ability to download files.

    We suggest that you can make suggestions on this SharePoint Feedback portal for downloading All Attachments from Multiple Selected Items in a SharePoint List. Your contribution will be highly appreciated.

    Downloading attachments for individual items is doable:

    To download attachments of a particular list item, open the item in view or edit mode, right-click on each attachment, and choose “Save link as” from the browser context menu. The file has a .htm extension, but you can choose to open it with office software (Word, Excel, etc.).

    download attachments in sharepoint


    Based on your description, you may be wanting to get certain items in the list based on their values in a certain column. So, I'll cover using Power Shell and Power Automate to download attachments. However, both are a bit complicated, and you can choose either one.

    First, we can use PowerShell to filter the items based on the column value and get their attachments.

    1.Install the PnP PowerShell Module for SharePoint Online

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link. 

    2.We need to write CAML to add our filters.

    For example, the value of the choice column named ProjectStatus is Completed.

    #CAML Query to Filter List Items.
    $Query = "<View><Query><Where><Eq><FieldRef Name='ProjectStatus' /><Value Type='Choice'>Completed</Value></Eq></Where></Query></View>"
    

    You can refer to this article to learn CAML Query, and then write a Query that meets your requirements.

    SharePoint Online: How to Use CAML Query in PowerShell?

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link. 

    3.Integrate your query into PnP PowerShell by downloading the attached files.

    #Set Parameters
    $SiteURL = "https://YOUR DOMAIN.sharepoint.com/sites/YOUR SITE NAME"
    $ListName = "YOUR LIST NAME"
    $DownloadPath = "C:\Temp\YOUR DOWNLOAD PATH"
    
    $ClientID = "YOUR CLIENTID"
    # Connect to SharePoint Online site
    Connect-PnPOnline -Url $SiteURL -Interactive -ClientId $ClientID
    
    #CAML Query to Filter List Items
    $Query = "YOUR QUERY"
    
    #Get All List Items matching given query
    $ListItems = Get-PnPListItem -List $ListName -Query $Query
    
    #Iterate through List Items
    ForEach($Item in $Listitems)
    {
    #Get Attachments from List Item
    $Attachments = Get-PnPProperty -ClientObject $Item -Property "AttachmentFiles"
    
    #Download All Attachments from List item
    Write-host "Downloading Attachments from List item '$($Item.ID)', Attachments Found: $($Attachments.Count)"
    
    #Create directory for each list item
    $DownloadLocation = $DownloadPath+$Item.ID
    If (!(Test-Path -path $DownloadLocation)) { New-Item $DownloadLocation -type Directory | Out-Null }
    
    $Attachments | ForEach-Object {
    Get-PnPFile -Url $_.ServerRelativeUrl -FileName $_.FileName -Path $DownloadLocation -AsFile -Force
    }
    }
    

    Reference: SharePoint Online: Download Attachments from List using PowerShell

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


    Secondly, we can create a stream through Power Automate to get the attached files.

    Step 1: Create a Flow in Power Automate

    • Build an instant cloud flow
    • Select "Manually trigger a flow"User's image
    • Please close "New designer" Feature. User's image

    Step 2: Add a “Get Items” Action.

    Select and add the Get Items flow action, and provide the Site Address, List Name, and Filter query condition. Select and add the Get Items flow action, and provide the Site Address, List Name, and Filter query condition.

    User's image

    You can follow this article to learn more about filter query syntax and then define your filter queries.

    How to Use Power Automate Get Items Filter Query + 8 Examples

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link. 

    Step 3: Add a “Get Item” Action

    In the ID section select the ID you obtained in the step 2.

    Step 4: Add a “Get Attachments” Action

    In the ID section select the ID you obtained in the step3.

    User's image

    User's image

    Step 5: Add a “Get Attachment Content” Action

    In the ID section select the ID you obtained in the step 3.

    In the File Identifier section select the Id you obtained in the step 4.

    User's image

    Step 6: Add a “Create file” Action Step 5: Add a “Create file” Action

    Save the attachments you get to the document library, after that we can download the files to your local computer.

    User's image


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. Tony 5 Reputation points
    2024-10-18T17:21:34.8166667+00:00

    Yes, it is possible to download all attachments from multiple selected items in a SharePoint list, though the method depends on the tools you have available:

    1. Using SharePoint Interface:
      • SharePoint itself doesn't natively support downloading all attachments from multiple list items at once. You would have to download attachments one item at a time by opening each item and downloading manually.
    2. Using Power Automate (Flow):
      • You can automate this process using Power Automate (previously known as Flow). You can create a flow that loops through selected items in a SharePoint list, retrieves the attachments, and stores them in a specified location, such as OneDrive or a SharePoint library, from where they can be downloaded.
    3. Using SharePoint Designer or Scripting:
      • SharePoint Designer or a script using PowerShell or Pnp PowerShell can also help automate downloading multiple attachments. These scripts can loop through the list items, extract attachments, and store them in a local or cloud location.
    4. Third-Party Tools:
      • There are some third-party tools available that allow bulk downloading of attachments from SharePoint lists.

    Using Power Automate or scripting tends to be the most flexible and efficient method if you need to handle a large volume of attachments.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.