Mail > Save attachment not saving the attachments because attachment Name as special character i.e colon :

I’m facing issue while saving attachments because the attachment name contains special characters i.e : (colon)
Ex for attachment is : FW: This is a name

so, I’m getting an error as access to save path denied.
any solution for this issue ?

@anushaanugowda57,

Refer this solution.

Thanks,
Ashok :slight_smile:

Try to remove the special chars from the Name by using RegEx and replace method. Then you’ll get a proper file name to save it.

Does this work if attachment name as special characters

before saving it to the folder we can’t edit it

@anushaanugowda57 Give it a try!

Im using office 365 to read the emails .i tried to invoke the code but getting error

we are wondering, how this invalid filename can occur.
However, we do feel that with an alternate handling and custom save routine we have a chance to overcome it.

please do one favor for us and share the output with us:

  • immediate panel - yourEmailVar.Attachments.Select(Function (x) x.Name).toArray

Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

Hi ,please find the below screenshot

looks strange as an empty name.

Lets more dive into and check with in_EmailMessage.Attachments(0)

Hi ,please find the screenshot
image

as we can see name is empty but you mentioned:

we keep in mind, that we had seen the behavior of getting removed invalid chars when using the save attachments activity.

But in general we are right in our assumption that the attachment is a forwarded/attached email, right?

But in general we are right in our assumption that the attachment is a forwarded/attached email, right?
Answer : Right ( and Attached email name .ie subject line always will have RE:)

As mentioned the problem is the empty name

In such case we can think about:

  • sorting it out for manually handling
  • renaming the attachment with a default name / repair name

You mentioned:

But we can do:
Assign Activity:
myMailCopy = myMailVar.Copy

and then we can rename the myMailCopy Attachments Names when we have detected an invalid/empty name

Hi @ppr
This works Thank you so much.
But i also have some issue. After saving it as .msg seeing error popup while opening it. please find the below screenshot. But i don’t see any issue if i save it as .eml format. But for process we need it in .msg format only.
Using save mail message activity / rename file activity to renaming it to .msg
Can you please provide some solution to this?

lets refer to:

and use this information for the name fixing

UPD1: But we keep in mind:

  • using a different filetype extension is not doing a conversion. So if eml is working but msg is needed it has to be converted afterwards

Lets scope the topic only to the saving challenge. For eml-msg conversion ope a new topic if additional assistance is needed.

Sure @ppr
Thank you so much for this help.

Perfect, so the topic can be closed by marking the solving post
Forum FAQ - How to mark a post as a solution - News / Tutorials - UiPath Community Forum

1 Like

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