How to add file attachments in the send mail action?
Hello,
how can I add files from a Document Library as attachment to the Send Mail action? Where the user should be able to pick files from a filtered list of documents that are stored on a Document Library (same site).
We use the preview of the email that the action is going to be send. Here you have a link add attachment, but that is going to be a dialog to choose a file from the local computer :(
Any tips on how to achieve this?
Thanks and Cheers
Joerg
-
Hi Joerg
You can achieve this case with skybow List Actions.
The user select first the documents to attach to the email and press the List Action button containing the Send email action.
Configuration of List Action
1. Create List Action in execution context of Current list
2. Create a variable named "attachments" of type array like this:
3. Loop on the selected documents with [[@SelectedItems]] placeholder and fill the file urls of the selected documents into the array variable:
Value expression of Set variable action (use expression of type Function):
var attachmentarray = [[@Variables.attachments]];
attachmentarray.push([[@Web.QueryList([[@List.ServerRelativeUrl]], '<Where><Eq><FieldRef Name="ID" /><Value Type="Integer">[[=[[@Actions.Loop_selected_Items.CurrentItem]].ID]]</Value></Eq></Where>', 1, 'FileRef', 'Scope=Recursive')]][0].FileRef);
return attachmentarray;4. Use the array variable in the Attachments property of the Send email action
Expression (type Assignment):[[@Variables.attachments]].join(';')0 -
Hey Christof, I keep getting this error message when I try and execute the list action.
Failed to evaluate property "Value" in "Set variable": Error occurred on evaluating expression "{ var attachmentarray = [[@Variables.attachments]]; attachmentarray.push([[@Web.QueryList([[@List.ServerRelativeUrl]], '<Where><Eq><FieldRef Name="ID" /><Value Type="Integer">[[=[[@Actions.Loop_selected_Items.CurrentItem]].ID]]</Value></Eq></Where>', 1, 'FileRef', 'Scope=Recursive')]][0].FileRef); return attachmentarray; }". Action "Loop_selected_Items" has not been executed yet.
Any ideas on how I can fix this?
0 -
Hi Jay,
seems your Loop Action is not same named as in my example. Replace this part in the expression [[@Actions.Loop_selected_Items.CurrentItem]] with your own Action output. You can get it from Actions in the Expression Builder:0
Please sign in to leave a comment.
Comments
3 comments