Error - Index was out of range

image
In the picture, you can see my problem, i dont know how fix this, Can you help my pls?

You are accessing an array or collection, and asking for an item in it that does not exist.

If this is the collection 'MyObjects: {book, car, tree} there are three items in it. They are numbered by an index, starting at 0.

so

MyObjects(0) = book
MyObjects(1) = car
MyObjects(2) = tree

If you would ask for MyObects(3) you’d request an non exising item, same as your error.
In your case a collection of mail items.

Often: If you correct your item number for the fact that it starts the index at 0 solves the problem. If not, trace all your variables during runtime and see the# of items in the collection, and the value of your index when it occurs.

Hi Jose Maria,

Could you please provide more detail around what you are trying to do.

If you could share the code that will be very useful as well.

Yes! I’m trying to do a course activity which consists of getting data from my outlook and process this. I attach you a better picture.
Thank you for the support!!!

Ok I see what is happening.

You are getting this error cause you are trying to save the attachment of an email that don’t have any. Hence the index out of range.

I would recommend you to use the

Save Last Task Mail Attachment

Within a for each activity. This way if the email don’t have an attachment it won’t execute the activity. And if there is more than 1, it will download all attachments.

Hope this helps

In my email, i have only one massage, i attach you one photos of my email, but I will try to do what you told me

Sorry Sebastian for being so heavy, but reading what you told me, I already put “save last mail attachment”. I dont understand very well what you see, sorry, I’m a beginner​:sweat_smile::sweat_smile:.
PD: Do you speak spanish? My english is regular

Yes I do.

I´ll send you a private message to I can help you out better.