Hi
I need to open an email of a particular subject and then click on the URL inside that email .
I have used Get outlook Mail message activity to get the top 30 emails then applied a For each loop adding condition as item.Subject.Contains(“SUBJECT”) but I am stuck as then condition of this For Each loop should open that email and then click on the hyperlink inside email .
Please suggest how can it be performed using Uipath
Thanks
Seeking help as what should be the sequence Activity of THEN part in FOR Each loop . How will uipath open a mail and then select the hyperlink inside it.
for each myMail in mails
if myMail.Subject.ToString.contains(“some string”)
if myMail.Body.ToString.contains(“http://”) or myMail.Body.ToString.contains(“https://”)
extract the url from the body
Openbrowser (url)
look for the stock etc…
end if
end if
end for
Thanks, I saved the body in text file . The mail has various URL I want to select the URL in last field .
How should RegEx looks like in this scenario ?
Use this sequence in the THEN part of your For Each Loop
Use Matches Activity
Edit properties section as follows: Input - ‘item.Body.ToString’ Pattern - "[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)" Result - Assign any suitable variableName
Use Open Browser Activity
Edit properties section as follows: Url - variableName(0).value
This will open the first Url with pattern of http, https or a url without any protocol.
To open the last url in the body.
Get the count of IENumerable variableName string
Pass this count in place of ‘0’ in open browser.
An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
UiPath.Core.BrowserOperationException: Cannot communicate with Internet Explorer browser. ----> System.Runtime.InteropServices.COMException: Cannot communicate with Internet Explorer browser.
at UiPath.UiBrowserClass.Open(String bstrURL, UiBrowserFlags flag)
at UiPath.Core.Browser.Open(String url, Boolean privateSession, Boolean headlessSession, Boolean defaultSession)
— End of inner ExceptionDetail stack trace —
at UiPath.Core.Activities.ScopeActivity.EndExecute(NativeActivityContext context, IAsyncResult result)
at UiPath.Core.Activities.AsyncNativeActivity.BookmarkResumptionCallback(NativeActivityContext context, Bookmark bookmark, Object value)
at System.Activities.Runtime.BookmarkCallbackWrapper.Invoke(NativeActivityContext context, Bookmark bookmark, Object value)
at System.Activities.Runtime.BookmarkWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)