Skip to main content
Email connect action for Outlook

I am trying to connect to a shared mailbox but the outlook of the current machine it is connected to currently is not in that shared mailbox. Plus, this is a dropdown list, so the use of variable is not allowed.

Is there a workaround, in AA itself to allow connection to a shared mailbox using Outlook. 

Note: Please do not suggest workaround or changes to be made within outlook as it is not possible for my case for some reasons.

Hi @nuranees,

You’ll be able to use the outlook option when you have a outlook application installed on your development or targeted production machine and that outlook should have the targeted mailbox signed-in. If these parameters are matching then you’ll find the account Id in the dropdown.

 

Otherwise, you can use the Email Server option which will get connected the outlook over O-Auth and no matter the outlook application installed or not on the machine, you will be able to access the mailbox.

Hope this helps!


Hi @Abhay Naik,

thank you for your respond.

Let say I connect to email server instead of Outlook as you suggested, I won’t be able to specify which mailbox I want to connect to or can I?
And will I still be able to use the other email actions such as Reply to (reply to existing email), if i connect to Email server?


@nuranees ,

You will be able to connect desired mailbox. Email Server will ask you to put username of the targeted mailbox. With O-Auth you’ll have to put the Client-ID and Client-Secret which are the unique parameter for the specific user.

Also, you be able to use all the email actions available in the package with this approach.


@Abhay Naik ,
Oh alright. So, the username will be the email address and the password will be the email account password, correct?

What about Client-ID and Client-Secret, which one are you referring to?

I am wondering how to connect to the desired mailbox as you mentioned, because I want to connect to a shared mailbox and not the primary/default inbox, where can I specify the mailbox I want to connect to? 

 


@nuranees 

Just Username and Password is called Basic Authentication. Microsoft and Google has disabled the the basic authentication now. So, O-Auth is the new authentication check that we have to do for any connections. O-Auth will ask you for the Client-ID and Client Secret along with Username.

 

To Specifically target the mailbox in the user account, you can use the loop for each mail in the mailbox after establishing the connection. There it will ask you to specify the folder name like “Inbox” etc.

Also, I think i might have misunderstood the issue that you are facing. Could you quickly check below things

  1. When using Outlook are you getting the email ID in the drop down where your targeted mailbox is?
  2. If yes, then select that email ID to establish the connection.
  3. Then use the loop action with the same session as that of connection command and put the iteration as each mail in the mailbox. This will ask you to specify folders. Type in your folder name if its not inbox. Also, you can select if you want to loop through Read, unread or All emails.
  4. Assign the output to the dictionary variable.
  5. Put a message box inside the loop and use that dictionary variable. and key lets say “emailSubject”. 
  6. Run the bot and see if the message box displays the email subjects of the emails present in the mailbox. if yes, then you problem is solved.

@Abhay Naik 

Thank you for the clarifications.

Let me answer your questions:

  1. Yes, I am able to see mailbox listed in the dropdown.
    Thank you for the detailed step by step. I have tried these before from step 1 until 6 and it works fine.

    However, the issue here is that, the current email ID in the current machine is not in the shared mailbox I want to connect to. The shared mailbox is in the email ID to be used in production later. Since it is a dropdown input, I cannot even input the shared mailbox name as a variable.
    Hence, I need workaround in AA itself because I cannot connect to the production email in the current machine due to some valid reasons.

@nuranees ,

Clear with the problem.

I think there are only 3 options for you.

  1. Connect creator to the runner machine before deploying it to production and capture the email-ID.
  2. Set he option as default/or keep empty(this way it select default only) and make sure the the runner machine has the targeted email ID and mailbox as primary or default. So wherever you move the bot it will take default.
  3. Update your email package to the latest one where there is a option of O-Auth. and use email Server option. The Client -ID and Client-Secret you’ll get from your IT.

 

In my case, Option 1 is not possible. Because any changes to the code must be made before entering production.

Between Option 2 and 3, I think Option 2 seems a better option and doable as of now.

I will try to test this out. Will update you the result.

Thanks a lot for all the suggestions!


Hi @Abhay Naik 

May I ask, Option 3 is applicable for which version?
Because currently my A360 is ver.25


Hi @nuranees,

Probably it is ver.26 onwards the O-auth option was put in if you are not able to see that option. Wonder if you are able to see below options under email connection.

 

Probably you’ll have to update the environment or the package to get O-Auth option.

You can use below links to get the details needed to configure the O-Auth.

https://docs.automationanywhere.com/bundle/enterprise-v2019/page/enterprise-cloud/topics/aae-client/bot-creator/commands/cloud-using-connect-action.html

 


Hi @Abhay Naik 

Quick update on the issue. 
I have already got the credentials to connect via EWS server: Client ID, Tenant ID, and Client Secret.
However, when tested the connection for the first time, it is not successful.

When using Authentication mode: OAuth2 - Client Credentials, the error is shown as below:

And when using the Authentication mode: OAuth2 - ROPC, it redirects to login page but after that the ‘Need admin approval’ pop up appears as shown below:
 


As of now, no permission has been delegated after the creation of the app in Azure.
May I know what are the permissions to be granted, in my case to connect to a shared mailbox?
 


@nuranees 
I am also facing a similar scenario. Please let me know if you were able to establish the connection using OAuth2 - Client Credentials mode?
Are you able to connect to the shared email inbox and read the email?

Appreciate your response !!


​Hi @Bijesh,

Unfortunately, I am still unable to establish the connection yet and I doubt that I will be able to do so.

Although our Email support team (Azure team) have followed the guide given by AA on the App registration in Azure, we still got the same error as below when using Client credentials authorization mode.

Step-by-step guide: How to setup an App in Azure to use OAuth2 with Client Credentials Flow for EWS Server? (automationanywhere.com)
 

After consulting with AA support team, again, it turns out that there are a few factors that may be contributing to this error.
Please refer to this doc: A360 | Email Connect (EWS): Unable to authorize the application with the provided credentials (automationanywhere.com)


We looked through all the possible causes mentioned in the doc and noticed that one of the requirements is the mailbox to be connected to require an E3 license in Outlook. 
This is our main concern and the reason for why we are unable to proceed with this method as the shared mailbox we are trying to connect to does not have an E3 license.

Hope this answers your question. 

Thank you.


Hi @Bijesh ,

Are you still looking into connecting to mailbox using Email server or EWS server via O-Auth?

Are you considering using Outlook method?


Reply