Hey Everyone,



Recently people have been coming to me with a common issue. They're stoked that SharePoint Document libraries are now supported in approvals, but they notice that when triggering off "when a file is created" that you arent able to expose the "get manager" action in O365 to be able to send approval to the document creators manager dynamically.

I went to the team with this dilemma and thanks to @merwan - he showed me this wonderful little workaround that i now want to share with you.



First, lets set up a couple of things ahead of time.

This tutorial assumes you have a SharePoint Document library, and for ease of use, its named "Documents"

Next, it also assumes you use O365 in your environment. If you dont have O365, this tutorial wont be as relevant for you.



Ok so first things first,

1. Head to https://flow.microsoft.com and login

2. Click on My Flows

3. Click on "+ Create from blank"

4. Add an action -> Select SharePoint -> "When an existing item is modified" -> enter your SharePoint url and then where it asks you to choose your list.. Manually type "Documents" (or whatever your Document library is named"

5. Add an action -> O365 -> Get Manager -> Open the dynamic content picker and use the SharePoint content piece "CreatedBy Email" this tells the O365 service to look up the manager of the person who created the document in the library. We will use this for the approval in a moment.

6. Next, Add a condition. (This is where the hackyness of this tutorial comes in. We are going to trick Flow into allowing us to see newly created items, and also acquire the manager of the creator, a function we couldnt achieve logically with the actions and triggers we were provided) and Make the condition read "Modfied" is equal to "Created"

7. In the IF YES column, add the "Approvals" Service and choose -> Start an approval.

8. Set all of your fields as desired in the approval email, the one important field being where it says "Assigned to" make sure andpass the "Email" dynamic content piece from O365 which represents the creators manager.

9. And voila! Thats all there is to it.

Now obviously, this flow isnt finished. It needs some additional actions under the approval as far as sending email to notify the user of approval or rejection, or maybe a push notification or maybe the Flow copies the file once approved to a seperate location.

How would you finish this flow? What steps should i add next?

Let me know if you guys have any questions!

- Jon L

Senior PM- Flow Team

@PNWAdventureGuy