Export SharePoint list To email

X

This site uses cookies. By continuing, you agree to their use. Learn more, including how to control cookies.

Introduction

Hi Friends, in this post let us examine how we can use Power Automate to export attachments from the SharePoint List item. To explain the usage of this scenario, let us extend this Cloud Flow to send the attachments in Email. Perhaps you can use the same concept of exporting the attachments and do the following

  1. Send the attachment over an email (will see in this post)
  2. Store all the attachments in a document library.
  3. Store all the attachments in a Onedrive folder.

Note The flow which I am gonna show you will use manual trigger but the same can be used with automatic triggers like When an item is added or modified etc.

Focus on the Flow

Consider a sample list with only the Title field and the attachments for the list has to be enabled. Add an item with a single or multiple attachments.

Let us start designing the flow

  • Create an Instant cloud flow, give a unique name and select the trigger Manual trigger a flow
  • Add an action named Initialize Variable as an array to store all the attachments from a list item.
  • Add an action named Get attachments and fill in the following properties
    • Site Address – SharePoint site where the list exists
    • List Name – Name of the list
    • Id – List item ID to export the attachment(s)
  • Add an action named Apply to each to traverse through the attachments and store the result in an array that is initialized in the above action.
  • Inside the Apply to each action add actions one below the other
    • Get attachment content – The above action Get attachments will not return the contents, but it returns the File Identifier and other metadata information. Using File Identifier we can get the attachment content.
    • Append to array variable – Append the Attachment name and Attachment content in the below format as a JSON array. The format mentioned below should be as it is without changing the key names. The same format is expected in the email action which we will add below the Apply to each action.

{ "Name": <Attachment Name>, "ContentBytes": <Attachment content> }

  • Add an action named Send an email (v2) to send the exported attachments to any user. Fill in the following properties. You have to collapse the advanced option for the attachments property.
    • To – To email of the user
    • Subject – Email subject
    • Body – Some email content
    • Attachments – Change it to dynamic values and pass the array variable as shown below

See how easy it is. Are you expecting anything? we are done with the flow. Execute the flow and enjoy the outcome.

Happy Flowing….

As said in the linked Response, the best way is to use SharePoint Designer WorkFlow 2013, or use Power Automate Flow (newer version), which both can extract Email Value from Person/Group Column.

Solution 1: Power Automate Flow

Its already answered in the mentioned Question, with screens

this solution request Power Automate Flow (flow.microsoft.com) (can be even Power Automate Flow Trial)

Solution 2: SharePoint Designer Workflow 2013

  • This solution required SharePoint Designer 2013 to be installed.

Create Site WorkFlow, that will loop through every item in the list and set new "Email" column by person/group "Name" column... In Udapte item in this list action you can specify, if you want to use DisplayName/ Email Address/ Login Name/ User ID

Picture: Update Item with Email Adress in SPD2013

Solution 3:JSON Column formating - Set with Buton (single item)

Not ideal for bulk edit, but someone might find this interesting...

Recently added feature allows set item properties directly from View by button click. using customRowAction in JSON column formating.

  1. Create one single line of text column.
  2. Use below JSON code to format the column
{ "$schema": "//developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "button", "customRowAction": { "action": "setValue", "actionInput": { "TARGETFIELD_HERE": "[$SOURCEFIELD_HERE.email]" } } , "attributes": { "class": "ms-fontColor-themePrimary ms-fontColor-themeDark--hover", "title": "Set Value" }, "style": { "border": "none", "background-color": "transparent", "cursor": "pointer" }, "children": [ { "elmType": "span", "attributes": { "iconName": "SchoolDataSyncLogo", "class": "ms-font-xxl" } } ] }

Video liên quan

Chủ đề