How to use Auth 2.0 for Send Exchange Mail Message for unattended robots?

Hey @Lakshmi_Holla

Kindly try the O365 activities.

Thanks
#nK

Yes we could. We need lot of permissions from admin to get application certificate and enabling them for REST API’s.

And we would have to convert nearly 40 robots in prod to this. So was wondering with the same Exchange mail activity if we could migrate to Auth 2.0.

Note: We use Get, Send,Move,Delete from exchange.

Why not just use Send SMTP Mail Message? Simpler, more reliable.

Hey @Lakshmi_Holla

Understood the pain ahead.

Did you check the updated latest package which has two more authentication options to use OAuth with same Exchange activity ? which supports Auth2.0

Thanks
#nK

I don’t have answer for this. I joined recently and there are already bots built with Exchange send/get email activities.

Which one you mean?

Interactive? – we tried this but we are getting pop-up to input credential one time in each machine its deployed

WindowsIntegrated – Cannot use this as windows username and actually mail details do not match.

Yep, interactive sign in and for the first time we need to manually handle.

Hey Lakshmi,

Here’s what UiPath Recommends - Exchange Online - Prepare For Basic Authentication Deprecation

Hope it helps!

We went ahead with o365 activities with Application id and secret id

1 Like

Hi Lakshmi,

We are facing the same challenge with implementing modern authentication in our old exchange mail activities using basic auth. Would you mind sharing a little more details on how you switch to O365 activities.

Hello Jianguo

Here is what we did.

  1. Create new Azure App (for access to O365 outlook mail activities using Graph API) with Client Secret and below 2 Graph API permissions;
    a. Mail.ReadWrite (with Type=Application). (Graph API)
    b. Mail.Send (with Type=Application). (Graph API)

  2. The newly created Azure App’s access should be restricted only to the required emails; otherwise with whichever email address bot can send the email.

  3. Take the below for the newly created Azure App;
    a. Application (Client) Id.
    b. Application (Client) Secret.
    c. Directory (Tenant) Id.

  4. downloaded UiPath.MicrosoftOffice365.Activities and used its mail activities in place of exchange mail. Utilize the Tenant Id, Application Id from the above in the Microsoft Scope.

1 Like

Thank you very much, Lakshmi! This is very helpful. I will start the app registration process in Azure.

Hi,

Can we use this for Exchange activities instead ?

Or with O365 activities only with these 2 details can we be able to use ?
a. Application (Client) Id.
b. Directory (Tenant) Id.

Thanks in advance

Hello Adithya

In exchange activity if you use the authentication type as ‘UserNameAndPassword’ it falls into basic authentication.

You can use Interactive type which is oAuth 2.0 but in our case the first time we used this, it asked for username and password to enter manually while running the bot. Ans also Interactive token is recommended for Attended Automation as per UiPath.

And ours is all unattended automation so we decided to switch to Microsoft activities.

Send Exchange Mail Message (uipath.com)

Thanks

Hi Lakshmi,

Thanks for the reply,

Using O365 activities, only with these 2 details can we be able to use ?
a. Application (Client) Id.
b. Directory (Tenant) Id.
i.e. without using client secret key

Thanks

I think IntegratedWindowsAuthentication requires only App ID and Tenant Id, but I haven’t tried that out. So cannot comment much.

More information can be found here :

Thanks

Got one Detailed & Helpful Steps Link!.

Hi Lakshmi,

I got my app registered in Azure and received app id, tenant ID, and client secret. I am now able to read email using “Get Mail” activity. However when I try to send email using “Send Mail” activity, I got the following error:

Send Mail: Code: BadRequest
Message: /me request is only valid with delegated authentication flow.
Inner error:
AdditionalData:
date: 2022-11-05T22:13:13
request-id: 06b3ec66-f0b5-44c6-ae29-58553351f1cc
client-request-id: 06b3ec66-f0b5-44c6-ae29-58553351f1cc
ClientRequestId: 06b3ec66-f0b5-44c6-ae29-58553351f1cc

BTW, Our permission is set up like the below:

Update: Issue resolved after populating the From address

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.