cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate II
Advocate II

Trigger Conditions - On file type in Sharepoint Document library

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

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User II
Dual Super User II

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

View solution in original post

5 REPLIES 5
Dual Super User II
Dual Super User II

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

View solution in original post

Community Support
Community Support

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.

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?

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,

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,

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (58,231)