I written the code for reading the unread emails
i.e i have to read every time all the new email from the Outlook.
So i have set the property(“Top”) of “Get outlook mail messages” “Top” property to =60 i.e Top=60. – is this the right thing to do??? Please let me know if any other ways are there…(i.e every time i have to read all the un read emails)
I just need to do the validations - i.e if emails exists or no … How shall i do this…? i have added the "Try catch " block …
also i am saving them to a Local folder - Suppose if no new emails then how to handle the errors ???
My main consern is handle to errors that is the BOT should not be crashed… How shall i ensure this??
PART 2:
Do i need to add the folder exists - activity??
There is one last thing - how to unzipp the files and save it to the other folder - this one i am not sure , kind of stuck…
@Seem i have done this before.
I hope u are using the REFramework. I suggest you do as it is the best way. If not you can see the below logic and try and put it in your process
I have done it like this,
Start activity
State 1 - Read emails, so you get the EmailList (top is fine)
… Check if the count in the list is >0 then save all your emails to folder, else nodata to process so i transition to End Process state
… Now in Init, fetch the list of emails from the folder and pass it to GetTransactionData where you will check the count of transactionNumber < List.count and you keep setting the transactionItem to the first mail from list and pass it to process.xaml where you can do your processing. This will lopp or all the items in the list.
No need to add folder exists in this case.
It says there in the activity, you pass the path with zip name in the first input
and the path to the folder where u want to extract the data.
Thanks for your replay…
I have to complete it today, very urgent…
What is - REFramework??? i am hearing this first time… Please tell me…
State 1 - Read emails,- is this any new activity… No i could not find it in Uipath…
Which Count??? Do i need to add any counter if so how to add it to the reading emails
Now in Init- ?
I am not able to understand further…
Please can you point it out in my .xaml… If you can …
I looked in to the .xaml. It solved most of my problems.
I have one question to you.
You can see that i have used the - Invoke Method - this idea was given to me by one of my colleague …
But i could not understand why to add it… i mean its purpose…
And i understood the - Unzip - activity added by you…
Invoke method is a handle to run methods sometimes when you are not using activities or they are not available.
This helps you in directly invoking an available class method like in your case System.IO.Compression.ZipFile and method ExtractToDirectory(does your unzip).
Yes its little difficult to get a hang of this as we are used to using activities thats why @balupad14 's custom activity here to make our lives more simple
Details of Invoke Method: InvokeMethod Properties :
MethodName: Assign the method name to this property. TargetObject: When we want to invoke non-static methods, we need first to create an object that contains the method to execute. TargetType: When we want to invoke static methods, we specify the type that contains the static method to execute. GenericTypeArguments: When we want to invoke a generic method, we specify generic types in this collection. Parameters : The parameter collection of the method to be invoked. Result: The return value of the method execution.
If you want to get your file name - “System.IO.Path.GetFileNameWithoutExtension(item)”
use this code.
In your case , these are stored in the variable “Filename”
If you want , you can remove your message box also.
message box wont affect anywhere in your program, that is used only for pop-up /display purpose.