Attach all files in a folder

outlook

#1

Hi All,

Is there a way to attach all files in a folder to an outlook mail without having to specify the file names .

Thanks


#2

Hi,

How about first zip all files using
ZipFile.CreateFromDirectory(startPath, zipPath);
ZipFile.ExtractToDirectory(zipPath, extractPath);

and pass the value in"Attach File" property of “Send Outlook Mail Message”

PS:Make sure you import System.IO.Compression.FileSystem manually.


#3

Besides Dilip’s solution, if your channel has blocked zip formats you may try below solution, I assume it should work for outlook as well.


#4

Compress has thrown an exception

Message: Access to the path ‘C:\Users’ is denied.

Source: Assign

Exception Type: UnauthorizedAccessException


#6

@ddpadil

I have the file system imported:

I am trying the following :slight_smile:

What should be the variable type for this Assign ,

I am getting an error saying ZipFile is not declared


#7

You can try this.

You need to open your .XAML file in notepad, search for AssemblyReference where you will see all the Namespaces imported to your workflow. At the end add a Tag

Even your code should work after you add the reference.

<AssemblyReference>System.IO.Compression.FileSystem</AssemblyReference>


Emailing back a file
#8

I added the Assembly ref code to the Xaml file, but get the following error.

Compress (2) has thrown an exception

Message: Access to the path ‘C:\Users’ is denied.

Source: Assign

Exception Type: UnauthorizedAccessException

System.UnauthorizedAccessException: Access to the path ‘C:\Users’ is denied.


#9

Variable type for assign should be zip:System.IO.Compression.ZipArchive
Regarding error.
Hope your having admin privileges please change the workflow directly and give a try.