Print all files in a folder


I have been trying for some time now to print all the attachments in an inbox on my outlook account.
It works okay, however, I want to see if I can find a more reliable method. That didn’t require those manual clicks (right click attachment, pressing print). This isn’t accurate enough.

I want it also to run in the background, so if I was able to utilise get outlook mail message → save attachment → (Some kind of print activity). Any suggestions?

Today I use get outlook to find all the messages, then press the top mail, click attachment, click print, move mail to different folder. Repeat the process.

I have looked into rules in Outlook also. But I would have to make my own script to print attachments.



Hi @Smith93 - did you manage to achieve this? I’m also having the same issue.



No, I didn’t…

Hey @Olivia & @Smith93

Do you just want background automation of your process - meaning using Simulate Click and minimized window of Outlook or let’s say fully background - via API maybe?

For the second option there is no Print activity for now I think mostly because it depends a lot on the document type that you want to print - from what I’ve understood while reading some articles related to this.

For reference:
c# - Which Windows Print API to call from .net program - Stack Overflow - “Er, those are fancy doc types!! It sounds like you are looking for Windows API functions that can print Word and Excel documents. Is that right? Anyway, no such functions exist. You need Word and Excel. Or a 3rd party library like Aspose. No 3rd party library will do the job as well as the original app though” - this is what some users say.

So I think you can achieve the fully background automation but it would need much more research and testing than what I did.

My suggestion would be to make use of the background automation we currently have (with Simulate option).



@ovi @Smith93

Hi both,

What I wanted was to just be able to send a print command to a printer queue on my network. We found a way to do this in the end.

In UiPath, we used ‘Invoke power shell’ activity and the command used is “print /d:\<ServerName><ShareName> filename”


Thanks for sharing your solution, Olivia.

Hi Olivia.

Could you please provide your XAML as I am not having success reproducing your solution.


EDIT: For future web searches, a solution I found for bulk printing PDFs in a directory is;

  • Directory.GetFiles(targetFolder, “*.pdf”) to get an array of strings containing the file paths
  • For each string in array
  • Remove spaces from file path string
  • Start process FileName “C:\Program Files (x86)\SumatraPDF\SumatraPDF.exe” with Arguments "-print-to-default " + filePath

Note this is dependent on;

  • Having SumatraPDF install (free and open source)
  • File path not have any spaces as I had trouble getting SumatraPDF to take file paths with spaces in it. If anyone finds a fix for this, please share.

I hope it helps.