web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / SharePoint - For a sel...
Power Automate
Unanswered

SharePoint - For a selected file Trigger

(1) ShareShare
ReportReport
Posted on by

Hi All,

 

I'm trying to use the SharePoint trigger "For a selected file". I don't understand how to make this flow run. I've opened a number of files from the selected SharePoint document library from the same user that created the flow but nothing runs.

 

I found this thread: https://powerusers.microsoft.com/t5/General-Power-Automate/Sharepoint-trigger-for-a-selected-item/td-p/55528/page/2

 

It is very unclear there if this trigger is supposed to work at all and how it's actually meant to work.

Can someone who understands this please advise?

 

Thanks

Sam

Categories:
I have the same question (0)
  • Verified answer
    ChristianAbata Profile Picture
    8,951 Most Valuable Professional on at

    hi @Anonymous  for a selected file means that you need to clic on the file to see the flows that you have created.

    see

     

    file.png

     

    when you create a flow for a selected file you are going to be able to see your created flow in the list of automate, clicking right on your file.

  • RobElliott Profile Picture
    10,323 Super User 2025 Season 2 on at

    @Anonymous  the "For a selected file" does indeed work and works very well. One way I use it several times a week is to publish an adaptive card to our company's All-Staff Teams site whenever I publish a news item on our SharePoint intranet (just another method of putting news in front of staff!)

    I have a column in my Site Pages library on our intranet that is a single line of text column, formatted with JSON to show a button that is linked to the flow. When you click on the button the flow starts and posts the item to the Teams channel. The actionParams line should have the  ID of your flow, so you'll need to create the flow first:

    0-SP-list.png

    The JSON code is as follows (don't forget to change the ID of the flow to yours and to change or delete the  the visibility line:

     

    {
     "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
     "elmType": "button",
     "txtContent": "Publish to Teams",
     "customRowAction": {
     "action": "executeFlow",
     "actionParams": "{\"id\": \"021ec4e0-8f85-46b3-a557-a4456960a4eb\"}"
     },
     "style": {
     "background-color": "#468259",
     "color": "white",
     "visibility": "=if(([$PublishedToTeams] == 'Yes'),'hidden','visible')"
     }
    }

     

    The flow looks like this with the trigger being a SharePoint "For a selected file":

    1-flowTrigger-Compose-Get-Compose.png

     

    2-Apply-Compose-Post.png

    I then update the Site Pages library and switch the PublishedToTeams column to Yes which hides the button in the list. 

    3-Update.png

     The result in Teams looks like this:
    4-resultTeams.png

    Rob
    Los Gallardos
    If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

  • Community Power Platform Member Profile Picture
    on at

    @RobElliott @ChristianAbata Thanks both for the detailed explanations.

  • ChristianAbata Profile Picture
    8,951 Most Valuable Professional on at

    @Anonymous  you are welcome, please consider to mark an aswer as solution to guide others

  • Community Power Platform Member Profile Picture
    on at

    Hi @RobElliott 

     

    Not sure if my previous msg was posted. 

     

    Does the button works only for flow owners? I created a button "Start flow" similar to yours "Publish to Teams" and it triggers the flow, but only for me(flow owner) and not for other users.

     

    Is there any solution for this? I need the flow to be triggered for all sharepoint site users and not only for me.

  • SS-28022152-0 Profile Picture
    3 on at

    Yes I have the same issue/question. Is there any way to allow other user to trigger the flow?

  • benny_blanco Profile Picture
    68 on at

    Is that trigger For Selected File only a manual process, I mean, it works only if you go to the file and click on the flow, can't it be set to run automatically only whenever this particular file is modified? Let's say you have 11 more other documents in the same library, can you trigger a flow to run specifically for the selected document only, not for the other ones?

  • RobElliott Profile Picture
    10,323 Super User 2025 Season 2 on at

    @benny_blanco the For a Selected File trigger is a manual trigger for a specific file, usually in my case from a button in a SharePoint list/library. What  you need to use is When a file is created or modified. That will only run for the specific file that has been modified.

     

    Rob
    Los Gallardos
    If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

  • benny_blanco Profile Picture
    68 on at

    @RobElliott I know which is the trigger to be used for when an item is modified. Looking for something that will automatically trigger only for a selected document. Let's say we have 11 files in the same document library, each having a separate Flow set to trigger itself on item modification. But I want each Flow to only run for its own document, otherwise each Flow runs for all modified documents. Let's say out of the 11 documents only 2 are modified, but all 11 automations will run as well. In this case I'm looking how to make out of the 11 flows only the two that are related with the modified documents to run for them, the other 9 to check if the modification is for their related documents and if not, to stop and not run. Any ideas how to achieve that? Thank you!

  • RobElliott Profile Picture
    10,323 Super User 2025 Season 2 on at

    @benny_blanco The For a selected file trigger requires you to select the item for which you want the flow to run, it won't run automatically. Then, as I mentioned in my previous post, you can have a JSON-formatted button in a single line of text column in your list or library. Selecting the button against each item will run the flow.

     

    postButton.png

     

    The JSON for that example is below:

    {
     "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
     "elmType": "button",
     "txtContent": "Publish to Teams & Yammer",
     "customRowAction": {
     "action": "executeFlow",
     "actionParams": "{\"id\": \"021ec4e0-8f85-46b3-a557-a4456960a4eb\",\"headerText\":\"All Things REI\",\"runFlowButtonText\":\"Publish Now\"}"
     },
     "style": {
     "background-color": "#468259",
     "color": "white",
     "visibility": "=if(([$PublishedToTeams] == 'Yes'),'hidden','visible')"
     }
    }


    If I've misunderstood then you'll need to post some screenshots of what your flows are trying to do.

    Rob
    Los Gallardos
    If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard