How to fetch the user outlook account mail address using uipath?

Hi Guys,

Can anyone have solution for my scenario, In the send outlook mail activity instead of giving the mail id manually, is there any other chances to fetch the user’s outlook mail address using any of the actions.

1 Like

I’m not giving any mail account in the properties of send outlook mail activity. The activity is sending mail from the logged in user mail account.

1 Like

You can use IMAP(to read and move mails) or smtp(to send mails) Activity to access user’s outlook account

  1. the Domain name, User name, and Password required

In case of any queries or concerns , let me know

1 Like

Thanks for your reply, but found another way to get current user’s mail id using vba

Private Sub mail_ID()
With CreateObject(“Outlook.Application”).GetNamespace(“MAPI”)
'MsgBox .Session.CurrentUser
'MsgBox .Session.CurrentUser.Address

mymailid = .Session.CurrentUser.AddressEntry.GetExchangeUser.PrimarySmtpAddress

ThisWorkbook.Sheets(“EmailAddress”).Range(“A2”) = mymailid

End With
End Sub

and then integrated to uipath , inside the excel scope application execute the macro and got he current users email address as output.

Thanks for your reply surya, but found another way to get current user’s mail id using vba

Private Sub mail_ID()
With CreateObject(“Outlook.Application”).GetNamespace(“MAPI”)
'MsgBox .Session.CurrentUser
'MsgBox .Session.CurrentUser.Address

mymailid = .Session.CurrentUser.AddressEntry.GetExchangeUser.PrimarySmtpAddress

ThisWorkbook.Sheets(“EmailAddress”).Range(“A2”) = mymailid

End With
End Sub

and then integrated to uipath , inside the excel scope application execute the macro and got he current users email address as output.

1 Like

That’s great

1 Like

Without using VBA you can use UiPath. Use a ForEach file in directory.GetFiles("C:\Users" + Environment.username + “\AppData\Local\Microsoft\Outlook”).

For the body use an If file.ToString.Contains(“.ost”) and not file.ToString.Contains(“tmp”) Assign NameVariable = file.ToString.Replace(“C:\Users" + Environment.username + “\AppData\Local\Microsoft\Outlook", “”).replace(”.ost”,“”).

Then just use RegEx to handle the format of the name.

image

The title of the outlook main window always has the email address in it. By fetching the title name once can easily extract the mail address of the active outlook session.

Following steps were used as part of this approach

  1. use attach window activity on the main outlook window and output the Application window into a window variable.
  2. In the ‘Do’ section of attach Window use get attribute activity and set the the target with the window variable and fetch the title.
  3. The title will consist of the email address.
  4. Use split function to extract the email address from the title string.