Hello Friends,
Welcome back with another post on Power Automate. Couple of days back, one interviewer asked me if we can send mail from Power Automate using mail account other than the creator of that Power Automate. I was not sure about that therefore I said that I don't know but as per my assumption, the person should be added as co-owner. 😞
Later on, I tried to find out if this could be possible. Surprisingly, I was correct but the answer was not complete. Because, first of all, the user should be co-owner. After then, in Connections, we have to switch the connection of outlook with that user's account connection. Let's try-
- First of all, create a simple list in SharePoint. I have created with name "SendOtherMail" having the default "Title" column.
- Now click on App Launcher (9 dots at top left corner) and click on Power Automate link.
- It will open the Power Automate portal. Click on + Create.
- Choose Automated cloud flow. Then provide a suitable name to the flow and choose trigger as When an item is created (SharePoint). Click on Create.
- It will create the flow and then ask you to choose the Site address and list name upon which it will work.
- Now add a step "Send an email (V2) Office 365 Outlook".
- Provide the input to the fields- "To", "Subject", "Body".
- If we execute the flow now, it will send email with the current owner capacity. But we want to send email from other account. So, we will save this flow as of now and will come back to it's details page by clicking on back arrow.
- Now click on Edit link of Owners section (#1 in below screenshot) to add a new co-owner.
- Search the new co-owner and add it.
- Then click on Manage Connections link in the Embedded connections section.
- It will load a page where all currently active connections will be displayed.
- If the added co-owner's outlook connection is getting displayed then click on ellipses (3 dots) ahead to that connection and choose Switch account. Otherwise click on + New connection link provided at the top and then choose Office 365 Outlook >> Create.
- It will the login credentials (Pick an account). Ask the user to provide credentials to create the connection.
- Once the connection get established, come back to the connections list.
- Look for the connection recently added and click on ellipses ahead of that connection. Choose Switch account from the popup list. When you click on Switch account, it will again show a popup where login accounts will be displayed. Choose the other user account.
- This way, outlook account has been switched.
- Now click on My flows >> Shared with me. As the flow has been shared with other user therefore, it will now appear in Shared with me tab.
- Click on the flow name and click on Edit.
- Expand the Send an Email action. Click on Show advanced options.
- Fill in the other user's email in From (Send as) input box and now Save the flow.
- Flow is now ready.
- Add an item in SharePoint list.
- Come back to Power Automate and check the Run history.
- As it can be seen that the flow has executed successfully.
- Now check the mail box.
- Hurray! The mail is received from other user's account. Now, if you ask the user to check his/her Sent Items in Outlook, he/she will find that the mail is reflecting in his/her Sent Items.
- This way, we can achieve this functionality.
With this, I am concluding this post.
Happy Coding !!!
Will see you again with some new topics.
Stay Safe !
Stay Healthy !
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.