Microsoft Flow - Get executing user

%3CLINGO-SUB%20id%3D%22lingo-sub-81498%22%20slang%3D%22en-US%22%3EMicrosoft%20Flow%20-%20Get%20executing%20user%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-81498%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20are%20trying%20to%20use%20Microsoft%20Flow%20for%20different%20scenarios%20-%20and%20we%20came%20across%20the%20need%20to%20get%20%22current%20user%22%20-%20meaning%20the%20user%2C%20who%20%3CU%3Estarts%3C%2FU%3E%26nbsp%3Bthe%20flow%20manually%20-%20and%20not%20the%20user%2C%20who%20published%20the%20flow.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20do%20have%20an%20action%20called%20%22Office%20365-users%20-%20Get%20current%20profile%22-something%2C%20but%20it%20takes%20the%20user%20who%20published%20the%20flow...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20help%20will%20be%20appreciated!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-81498%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-224211%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20Flow%20-%20Get%20executing%20user%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-224211%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Dave!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhile%20this%20issue%20isn't%20identical%20to%20the%20one%20I%20am%20experiencing%2C%20it%20is%20the%20closest%20occurrence%20I%20have%20found%20so%20far.%20I%20am%20working%20on%20a%20document%20approval%20Flow%20that%20triggers%20when%20a%20file%20is%20created%20in%20a%20folder.%20The%20next%20step%20is%20Get%20My%20Profile%20(v2)%20in%20order%20to%20associate%20the%20document%20being%20reviewed%20with%20its%20author.%20This%20way%2C%20our%20manager%20can%20know%20for%20whom%20the%20document%20is%20being%20approved.%20So%20far%2C%20this%20flow%20always%20associates%20the%20user%20who%20originally%20created%20the%20flow%20with%20the%20document%20needing%20approval%2C%20rather%20than%20the%20user%20triggering%20the%20flow%20by%20placing%20a%20document%20in%20the%20specified%20folder.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAre%20there%20any%20workarounds%20for%20this%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMuch%20appreciated!%3C%2FP%3E%3CP%3E-%20A%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-143390%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20Flow%20-%20Get%20executing%20user%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-143390%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Christopher%20-%20Hopefully%20this%20will%20save%20you%20the%20time!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFlow%20does%20run%20based%20upon%20the%20executing%20user%20rather%20than%20the%20person%20who%20produced%20the%20flow.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20found%20that%20my%20issue%20was%20due%20to%20a%20step%20earlier%20In%20the%20flow%20where%20the%20list%20item%20that%20triggered%20the%20flow%20is%20moved%20to%20a%20different%20location.%20By%20executing%20this%20step%2C%20I%20became%20the%20%22Created%20by%22%20user%2C%20which%20was%20my%20variable%20used%20to%20direct%20the%20flow%20through%20an%20approval.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20did%20feel%20silly%20when%20I%20worked%20it%20out!%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EThanks%20for%20looking%20though%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-143256%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20Flow%20-%20Get%20executing%20user%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-143256%22%20slang%3D%22en-US%22%3EYou%20are%20supposed%20to%20now%20be%20able%20to%20run%20a%20flow%20in%20context%20of%20the%20user%2C%20least%20I%20thought%20it%20was%20live%20by%20now.%20Currently%20looking%20around%20to%20see%20if%20I%20can%20find%20it.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-128449%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20Flow%20-%20Get%20executing%20user%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-128449%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20also%20having%20this%20issue%20-%20Has%20anybody%20found%20a%20workaround%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-100722%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20Flow%20-%20Get%20executing%20user%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-100722%22%20slang%3D%22en-US%22%3EHi%20Matthew.%20No%2C%20haven't%20looked%20into%20it%20lately.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-100563%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20Flow%20-%20Get%20executing%20user%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-100563%22%20slang%3D%22en-US%22%3EHi%2C%20did%20you%20ever%20solve%20this%3F%20Thanks%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-82806%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20Flow%20-%20Get%20executing%20user%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-82806%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Poul%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWell%20-%20that%20does%20reflect%20who%20%3CU%3Eoriginally%3C%2FU%3E%20created%20or%20modified%20the%20ListItem%20(or%20document)%20-%20not%20the%20user%2C%20who%20selects%20a%20Listitem%20or%20document%20in%20SharePoint%20and%20choosing%20a%20flow%20to%20start%20manually%2C%20like%20this%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20782px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F16525i1799D555BAE1E1E9%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-82410%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20Flow%20-%20Get%20executing%20user%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-82410%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20SharePoint%20item%20triggers%26nbsp%3Bprovide%20the%20Created%20By%20and%20Modified%20By%20properties.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-81759%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20Flow%20-%20Get%20executing%20user%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-81759%22%20slang%3D%22en-US%22%3EThe%20specific%20case%20is%20when%20a%20user%20manually%20starts%20a%20flow%20tied%20to%20a%20SharePoint%20List%20Item.%20But%20as%20you%20said%2C%20the%20options%20lies%20in%20the%20trigger%20itself.%20The%20Flow%20buttons%2C%20approval%20and%20others%20due%20offer%20the%20executing%20user%2C%20but%20SharePoint%20OnSelectedItem%20triggers%20appearently%20doesn't.%3CBR%20%2F%3E%3CBR%20%2F%3EAny%20idea%20to%20work%20around%20it%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-81542%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20Flow%20-%20Get%20executing%20user%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-81542%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20user%20who%20starts%20a%20flow%20is%20not%20known%20to%20the%20flow%20service%20unless%20the%20trigger%20provides%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20mention%20manually%20starting%20a%20trigger.%20Assuming%20that%20means%20a%20flow%20button%2C%20you%20can%20get%20the%20User%20email%20and%20User%20name%20properties%20from%20the%20%22Manually%20Trigger%20a%20Flow%22%20trigger.%20When%20displaying%20the%20dynamic%20content%2C%20scroll%20to%20the%20bottom%20of%20the%20list%20for%20the%20trigger.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-655703%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20Flow%20-%20Get%20executing%20user%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-655703%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F171008%22%20target%3D%22_blank%22%3E%40Anna%20DeKoning%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20getting%20the%20person%20who%20caused%20the%20flow%20to%20run%20based%20on%20a%20ShPt%20list%20NewItem%20trigger%2C%20use%20the%20dynamic%20property%20%22Created%20By%20Email%22%20to%20determine%20who%20the%20creator%20of%20the%20document%20is.%26nbsp%3B%20If%20you%20need%20to%20get%20that%20user's%20name%2C%20use%20their%20email%20as%20input%20for%20the%20Office%20365%20connector's%20%22Get%20User%20Profile%20(v2)%22%20function.%26nbsp%3B%20See%20ScottShearer's%20answer%20with%20screenshots%20here%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fpowerusers.microsoft.com%2Ft5%2FBuilding-Flows%2FGet-executing-user-in-Flow%2Ftd-p%2F135386%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fpowerusers.microsoft.com%2Ft5%2FBuilding-Flows%2FGet-executing-user-in-Flow%2Ftd-p%2F135386%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Deleted
Not applicable

Hi,

 

We are trying to use Microsoft Flow for different scenarios - and we came across the need to get "current user" - meaning the user, who starts the flow manually - and not the user, who published the flow.

 

We do have an action called "Office 365-users - Get current profile"-something, but it takes the user who published the flow...

 

Any help will be appreciated!

 

 

11 Replies
Highlighted

The user who starts a flow is not known to the flow service unless the trigger provides it.

 

You mention manually starting a trigger. Assuming that means a flow button, you can get the User email and User name properties from the "Manually Trigger a Flow" trigger. When displaying the dynamic content, scroll to the bottom of the list for the trigger.

Highlighted
The specific case is when a user manually starts a flow tied to a SharePoint List Item. But as you said, the options lies in the trigger itself. The Flow buttons, approval and others due offer the executing user, but SharePoint OnSelectedItem triggers appearently doesn't.

Any idea to work around it?
Highlighted

The SharePoint item triggers provide the Created By and Modified By properties. 

Highlighted

Hi Poul,

 

Well - that does reflect who originally created or modified the ListItem (or document) - not the user, who selects a Listitem or document in SharePoint and choosing a flow to start manually, like this:

image.png

Highlighted
Hi, did you ever solve this? Thanks
Highlighted
Hi Matthew. No, haven't looked into it lately.
Highlighted

I'm also having this issue - Has anybody found a workaround?

Highlighted
You are supposed to now be able to run a flow in context of the user, least I thought it was live by now. Currently looking around to see if I can find it.
Highlighted

Hi Christopher - Hopefully this will save you the time!

 

Flow does run based upon the executing user rather than the person who produced the flow.

 

I found that my issue was due to a step earlier In the flow where the list item that triggered the flow is moved to a different location. By executing this step, I became the "Created by" user, which was my variable used to direct the flow through an approval.

 

I did feel silly when I worked it out!


Thanks for looking though

Highlighted

Hi Dave!

 

While this issue isn't identical to the one I am experiencing, it is the closest occurrence I have found so far. I am working on a document approval Flow that triggers when a file is created in a folder. The next step is Get My Profile (v2) in order to associate the document being reviewed with its author. This way, our manager can know for whom the document is being approved. So far, this flow always associates the user who originally created the flow with the document needing approval, rather than the user triggering the flow by placing a document in the specified folder. 

 

Are there any workarounds for this?

 

Much appreciated!

- A

Highlighted

@Anna DeKoning 

 

For getting the person who caused the flow to run based on a ShPt list NewItem trigger, use the dynamic property "Created By Email" to determine who the creator of the document is.  If you need to get that user's name, use their email as input for the Office 365 connector's "Get User Profile (v2)" function.  See ScottShearer's answer with screenshots here: https://powerusers.microsoft.com/t5/Building-Flows/Get-executing-user-in-Flow/td-p/135386