Read outlook Emails from a subfolder and restart a window service

I am new to Uipath but have got an opportunity to work on an Automation project.

Problem :- many a times our services used to get freezed and it will stop posting our Invoices. If this happens then we will get mails to restart our service .

Requirement :- Read new Outlook mails from a inbox subfolder. If there are any unread mails then restart a window service (this is our application service).

I need help or guidance in the above mentioned requirement. Glad if the community could help me

Note :- The bot will always monitor for new mails.


Welcome to the UIPath Community.

Use Get Outlook MailMessage activity to read mails from outlook. To read unread mails then check Unread mails option in that activity. And it will give you output as List of MailMessages as output say ‘mailMessages

Then check condition like: mailMessages.Count > 0 then Restart window service else No.

Thanks @lakshman. But do we have any command or activity to restart the services ?

Also is it necessary to open outlook when we perfrom this operation?

1 Like

I tried with GetOutlook Mail Message but got the below error:-


Source: Get Outlook Mail Messages

Message: The operation has timed out.

Exception Type: System.TimeoutException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.TimeoutException: The operation has timed out.
at UiPath.Mail.Activities.GetMailActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Any clue?


Yes if we want to work with outlook then it should be installed in that machine and also it should be in Online.

Do you want to restart system or any particular windows service ?

@lakshman I want to restart a services only


You can use this activity to start, stop or restart any window services. Download this package and try it.