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 / Trigger Conditions - O...
Power Automate
Unanswered

Trigger Conditions - On file type in Sharepoint Document library

(0) ShareShare
ReportReport
Posted on by 175

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,143 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
    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
    175 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

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard