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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Trigger Conditions - O...
Power Automate
Answered

Trigger Conditions - On file type in Sharepoint Document library

(0) ShareShare
ReportReport
Posted on by 177

Hello,

 

Has anyone been able to successfully write a flow that uses a trigger condition on a sharepoint document library that only triggers when a specific file type is uploaded (.docx in this example)?

 

I am having a hard time getting a sharepoint document library to trigger only on docx files. Long story short, I am using the flow to convert docx files to pdf. The flow is looping back a 2nd time when the pdf file is created. If i can get the trigger condition to work, it will save me a 2nd flow run.

 

The main issue is getting the file type, file extension recognized. How can I write the trigger condition expression to do what I need? The other otpion is to extract the file name extension in sharepoint into another column as text. Then modify my trigger condition to look at that new column.

 

Capture.JPG

Categories:
I have the same question (0)
  • Verified answer
    RezaDorrani Profile Picture
    12,145 on at

    Hi @JasonK 

     

    Use following trigger condition for when an item is created or updated

     

    @contains(triggerBody()?['{FilenameWithExtension}'],'.docx')

     

    Regards,

    Reza Dorrani

     

    Regards,

    Reza Dorrani

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

  • v-alzhan-msft Profile Picture
    Microsoft Employee on at

    Hi @JasonK ,

     

    Please use the trigger "When a file is created or modified (properties only)" in the flow:

    1.png

     

    And use the expression below in the trigger Condition:

    @contains(triggerBody()?['{FilenameWithExtension}'],'.docx')

    Best regards,

    Alice       

     

    Community Support Team _ Alice Zhang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • JasonK Profile Picture
    177 on at

    Awesome, Thank you for the info. Worked as stated.

     

    Does anyone have any training resources on how to write Trigger conditions or better understand the structure?

  • hbenade Profile Picture
    9 on at

    The following worked for me for running on PDF documents only with the 'When a file is created or modified in a folder' Trigger:

     

    @equals(triggerOutputs()['headers']['Content-Type'],'application/pdf')

     

     

    Kind Regards,

  • hlokey Profile Picture
    9 on at

    Hi @RezaDorrani , 

     

    I tried using this trigger for my flow:   @contains(triggerBody()?['{FilenameWithExtension}'],'.jpg')

     

    but got the trigger error message below. It did not even run when I tested it.

     

    InvalidTemplate. Unable to process template language expressions for trigger 'When_a_file_is_created_in_a_folder' at line '1' and column '5997': 'The template language function 'contains' expects its first argument 'collection' to be a dictionary (object), an array or a string. The provided value is of type 'Null'.'.
     
    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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard