Invoke method : The process cannot access the file,because it is being used by another process

Dear all,
I meet problems, and I am sincerely wanna to anybody could help me.
for example, in one folder, there are some .docx files. if the number of .docxs files is larger(or equal) than 5, then compress the docx files, then the .zip files would be regarded as attached file to be sent via
outlook e-mail. If the he number of .docxs files is less than 5 , all of the docx files would be regarded as attached files and to be sent via outlook.

it generates error :
“message”: “Invoke method : The process cannot access the file ‘C:\Users\jiyiwei\Desktop\demo\压缩文件\demo.zip’ because it is being used by another process.”,

here is my code , anybody could help me solve this problem? thanks a lot in advanced .

2 Likes

@Chris-Yiwei, Please attach your source code.

1 Like

@Chris-Yiwei plz attach your flow.

1 Like

There are several scenarios which can lead to that error:

  1. The activity of sending zip file on Outlook starts while the files are still in progress of compressing ==> Wait till the compressing process completes before sending the zip file (one of the methods is to check if the size of the zip file is > 0 KB; if the zip file size is 0KB, the compressing process is still going on.)

  2. If the zip file is located in eg Onedrive, the sync process in Onedrive will “use” the zip file, hence prevent the Outlook activity from sending the file ==> Wait till the sync process completes OR turn off the sync process in Onedrive while Robot is working.

demo.xaml (35.2 KB)

here is my code

1 Like

here is my code demo.xaml (35.2 KB)

here is my code , could you help me check it ? thanks a lot for ur help demo.xaml (35.2 KB)

2 issues:

  1. In your code, if the number of .docs files are >= 5, all .docs files will be attached to a message on Outlook, not the zip file being attached to the message:

And in your first post: “if the number of .docxs files is larger(or equal) than 5, then compress the docx files, then the .zip files would be regarded as attached file to be sent via
outlook e-mail.”

  1. There’s no delay to wait till the process of compressing the files is done before the files are being attached to Outlook message. Pls add activities to Wait till the compressing process completes (one of the methods is to check if the size of the zip file is > 0 KB; if the zip file size is 0KB, the compressing process is still going on.)
2 Likes

thanks a lot for your reply.

could u help me modified it ? i am also feel confused .

Hi @Chris-Yiwei

I checked your code.
In your code ,the parent folder of the “extractPath” is “ZipPath”,So When create a compressed file, it is being used by Compressed process.Please change the path of “extractPath”.
image

1 Like

If i change, I must change the invoke method, parameter ?

@Chris-Yiwei,

Your process is running fine after changing the output zip folder path to a different folder not being used by anyone.

have done then changes. plz find the attachment.OutlookMail.xaml (45.0 KB)

Thanks

1 Like

I change the path , it still generates the some error

Hi @Chris-Yiwei

Please attach your err message.

it works fine ,thanks a lot !

another quesetion , if there are 4 word files in one folder, the name format of word files like:
20190711_xxxxxx
20190711_xxxxxx
20190708_xxxxx
20190701_xxxxx
how could achive the function, the subject of outlook mail as
20190711 has two files, 20190708 has 1 file, 20190701 has 1 file .

could you give me a demo ?
thanks a lot !

1 Like

Hi @Chris-Yiwei

I try to build a demo.


Get_File_GroupBy.zip (2.7 KB)

Hi @Chris-Yiwei
Get_File_GroupBy (2).zip (2.9 KB)
For your reference.

hey, i met a problem. use your OutlookMail.xaml

my UiPath Studio Version is 2019.06, this program generates error as follows

Invoke Method:
system.io.compression.ZipFile

the error is Invoke method: Access to the path ‘C:\Users\jiyiwei\Desktop\demo’ is denied.",

how could I solve it ? thanks a lot for your help

hey, buddy. I met a problem. use your OutlookMail.xaml
my UiPath Studio Version is 2019.06, this program generates error as follows
Invoke Method:
system.io.compression.ZipFile
The error is Invoke method: Access to the path ‘C:\Users\jiyiwei\Desktop\demo’ is denied.",
how could I solve it ? thanks a lot for your help

@Chris-Yiwei,

Plz for admin rights ,Check you have access to the folder.

Update the System.IO.Compression.

thanks
Sanjay