Array index error and file exist error

Greetings of the day…!!!
I am getting these error and also i am not able to specify the extension of the file how can i achieve it.


index%20error
run%20time%20error

Hi @soumi_soumiya

Regarding the second issue, an exception is thrown by Move File because the file that you want to move is already in the destination and cannot be overwritten. To overwrite, tick the Overwrite in the properties of the Move File Activity.

Then on the first one, please elaborate it further :slight_smile:

Thanks and regards

9 Likes

Thanks for your reply…
My Task is to read the subject line from the mail and save the attachment in a specified folder and rename the file with the sends mailid and date. So while performing this task it reads upto the subject line that exist and then gives this exception.
For example i am giving my input as java developer it search for java developer in the subject of the mails and opens the mails that matches with java developer and saves the attachment by creating a new folder with name java developer and renames he downloaded file with senders mail id and date. after reading the subject line of 5-6 mails it throws this exception… Hope so i am clear now

1 Like

hello @soumi_soumiya

if it working for first 4-5 mails and stopping in the middle, then it might be the issue with split string or output of split (array)

means you might have given a fixed index in split string method.
or size (index) of the split array (means split output stored in an array ) is less than what your expecting.

if possible share you code.

Regards
Ajay

Thanks for your reply
ReadGmailSoumi.xaml (32.3 KB)
here is my file

hello @soumi_soumiya

i have question in your , as in the below picture ,your using split method and passing the index values

now my question is why your starting with index (1) why not index (0)?
if your index value is correct, check the header date format (might be changing for some case)

image

for You Extension problem, while saving your not mentioning the extension,
your just saving using key value, but key value don’t have any extension. you need to specify the extension while saving it .

image
for move file problem, if there is already a file exists with same name then that problem will occur so please enable the overwrite property

Regards
Ajay

Thanks for your reply…
date

The above data is stored in a variable named dmy. I need only 18jul2019 so my array index starts from (1). And i dont know where thus the array excess error occurs because my file reads the data till the subject lines matched to the user input then only at last it puts an exception as
Assign : Index was outside the bounds of the array.

Regarding my extension problem where should i give my extension if i give my extension in save attachment then the extension occurs at the folder name not at the file name .
In move file activity i had given as follows “C:\Users\Soumiya\Desktop\”+Key+""+filename+dmyy+Extensionnnn
But the output is
file%20ext
I aslo gave .extension but it gives an error.

These are my problems
Thanks
Soumiya S
Dont know where to resolve it

for me below is working

image
try to print path and file and check is it coming as expected

1 Like

also your taking the extension from the saved file if i am not wrong,
to get the exact extension of the attachment use below expression

Split(item.Attachments(0).Name,cchar("."))(1)