Unable to save as .msg

Hi
I have used a get exchange mail message and i am trying to save the output in a local folder as a .msg file, but get a “System exception.The given path’s format is not supported. at Source: Invoke Workflow File: Save Mail Message”
I am trying to save under filepath in_local_path+“"+mail_subject+”.msg"

Does anybody know how to either convert from the .eml or preferably just directly save as .msg?

Sorry, wrong error message: “message”: “Invoke Workflow File: The given path’s format is not supported.”,

Hi @semn
Try the below expression

in_local_path+Mail_Subject+“.msg”

If possible can you share the in_local_path & Mail_Subject Values

Regards
Gokul

local_path=“C:\dagpengebreve_til_ledere”
mail_subject is dynamic based on the email

So the path (filepath in_local_path+“"+mail_subject+”.msg") is:
“C:\dagpengebreve_til_ledere\mail_subject.msg”

Hi

Try saving it as .eml instead of .msg file

And one more thing

This mail_subject should have some value

Validate that as well

Like this

in_local_path+“\”+If(String.IsNullOrEmpty(mail_subject.ToString), “new_mail_”+Datetime.Now.ToString(“hh_mm”), mail_subject.ToString)+”.msg"

Cheers @semn

The problem is I need to archive it in a repository where some users are unable to open the .eml file. I am able to save as .eml, but it is not a viable solution unfortunately

1 Like

Updated the previous comment
Try with this

Cheers @semn

I found a solution. The variable mail_subject is as mentioned a long subject with various characters ([, ], = etc.) and I can see that changing the name to a simple hardcoded name enables me to save as .msg

Thanks for the help

1 Like

Glad it got resolved

Is there any further queries on this topic

@semn

Actually yes. Now I have the msg file saved, but am unable to open it. I get the "Error- We can’t open ‘C:\Users\UiPath\mail.msg’.It’s possible the file is already open, or you don’t have permission to open it
same error as in these threads:

The workaround seems to be saving as .eml, but as mentioned previously that is now a viable option for this process. Anybody who knows why this error occurs?

That’s the main reason why I suggested for .eml file

.msg file won’t be accessed and even though it is sometimes the files embedded won’t be accessible

Pls look for a way of this can be used in .eml format with your users

Cheers

Hi you can resolved?

Hi guys,

I do not really think the issue is with .msg format itself. I have two processes still running on the production in which we are saving emails as .msg files and then we open those files to take a screenshot of the emails.
@semn could you please send the screenshot of the activity that you use for saving the email?

  1. check if the user which is trying to open those files has access and proper rights to do it under the desired path.
  2. Do you have outlook installed on the machine on which you want to open the .msg file?
  3. For the future automation I would reccomend using Path.Combine(arg1, arg2) while creating the path. :slight_smile:

Please take a look how it works on my side:
Saving emails:
image

There is no issue with attachments in the emails neither with the pictures or tables.

If you receive this error:

I have just recreated the error. It occurred only because I have already opened the file. Please close all the outlook processes before opening the file and also set the unique name for each saved email.

Cheers,
Kamil