Save Attachments activity not working for Filter ".pdf|.PDF"


I am trying to use the Save Attachments activity with the filter “.pdf|.PDF” to save a file to a folder if it has a pdf attachment, but I get the following error:
When I use the filter condition “.xlsx|.XLSX” this error does not occur and it seems to only happen for the pdf… How would I fix this error?

Note: I have also tried the following filters: “.pdf”, “(.|/)(?!PDF|pdf).", ".(.pdf|.PDF)” and they throw the same error :frowning:

try like this: (?i)(\.pdf)

1 Like

Unfortunately it is still giving me the same error… :cry:

well, you dont have any errors without the filter? please show us the details of the error, so we can see what happened.

I still experience these errors without the filter

@bcorrea this is the error I get when there is no filter
Which is still the same error

you need to open the details there…

Ohh I didn’t realize. Here are the details:

Source: Save Attachments
Message: One or more errors occurred.
Exception Type: System.AggregateException
RemoteException wrapping System.AggregateException: One or more errors occurred. —> RemoteException wrapping System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
at System.IO.PathHelper.GetFullPathName()
at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share)
at UiPath.Mail.Activities.SaveMailAttachments.<>c__DisplayClass17_0.b__0()
— End of inner exception stack trace —
at UiPath.Mail.Activities.SaveMailAttachments.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Consider saving your files in smaler path like in folder:


Ohhh thank you so much!

1 Like

I defined my file path like this:
so I don’t know why I keep getting this error :thinking:

because that will include the whole path of your project, that could be like c:\users\name\documents\.....

1 Like

Would storing the file path in something like the Config file from the framework eliminate this issue?

You need to keep in mind that the complete path to the file cannot exceed 260 chars…
"D:\UserData\Documents\UiPath\BlankLibrary1\my pdf with very long name will break me.json"

1 Like

Okay, I’ll keep that in mind. Thank you so much for your help! :smiley:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.