power-automate-desktop

Power Automate - Attachment does not have the actual name of the file


In a flow that creates an email, I'm attaching an attachment to the mail.

enter image description here

The problem is that the file name is renamed.

%Attachment% has the value: https://company.sharepoint.com/sites/Nord/Default/Company information gathering - Excel.xlsx

Becomes an attachment with the name: Company%20information%20gathering%20-%20Excel.xlsx

I need the actual file name to be used, so without %20, without URL encode.

Company information gathering -Excel.xlsx


Solution

  • This is how I did it..

    Get the file metadata from sharepoint, the info is saved in %GetFileMetadataResponse% getmetadata

    Then get file content using Get file content using path using the Path value from metadata %GetFileMetadataResponse.Path% and store it in %GetFileContentByPathResponse% filecontent

    Then create a temp file by converting the binary data from the file content in %GetFileContentByPathResponse% using 'Convert binary to file' action, getting the name from metadata %GetFileMetadataResponse.Name%.

    convertbinary

    Then assign variable %attachment% to temp file path C:\temp\%GetFileMetadataResponse.Name%

    setvariable

    and then use attachment as you usually would in send email.

    emailaatach

    The scenario is covered in the sharepoint documentation