cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Kudo Kingpin
Kudo Kingpin

Flow does not recognize filename or file extension of pdf file it just created in a condition

I want to enable my organization with a simple pdf converter. Drop a file into a directory and have a pdf file created in seconds.

 

We also embark on Sharepoint Online (SPO) journey. Therefore the converter folder should be on SPO and there might be multiple instances (e.g. for key meetings).

 

The flow is triggered when a file is created in a SPO folder. It takes the file content and creates a file in one drive.That file is converted and copied over to SPO Folder. All works well so far.

 

Yet the new pdf file triggers the flow again. So I try to stop the flow from converting a pdf from a pdf with a condition looking whether the file name contains "pdf". This fails. Now I try to add PDF_ to the begining of the file namePDF Converter 4-30-2018 8-18-52 PM.png

 

Why does the filename condition (contains pdf) not work?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Flow does not recognize filename or file extension of pdf file it just created in a condition

Hi @ErichH,

 

I think there is something wrong with the trigger within your flow, I have made a test on my side and please take a try with the following workaround:

  • Add a "When a file is created (properties only)" action, specify Site Address and Library Name.
  • Add a Condition, left input box set to File name with extension dynamic content of the trigger, right input box set to .pdf, within middle drop down, choose contains.
  • Within "If/yes" branch of Condition, add a "Send me an email notification" action.
  • Within "If/no" branch of Condition, add a "Get file content" action of SharePoint connector, File Identifier field set to Identifier dynamic content of the trigger.

         Add a "Create file" action, specify Folder Path, File Name set to File name with extension dynamic content of the trigger, File Content set to File Content dynamic content of the "Get file content" action (above action). 

        Add a "Convert file" action, File field set to Id dynamic content of the "Create file" action, Target Type set to PDF.

        Add a "Create file 2" action, specify Folder Path, File Name field set to File name dynamic content of the "Convert file" action, File Content field set to File content dynamic content of the "Convert file" action.

        Add a "Get file content 2" action of OneDriver connector, File field set to Id dynamic content of the "Create file 2" action.

        Add a "Create file 3" action of SharePoint connector, specify Site Address and Folder Path, File Name set to Display name dynamic content of the "Create file 2" action, File Content set to File content dynamic content of the "Get file content 2" action.

 

Image reference:25.JPG

 

26.JPG

 

27.JPG

The flow works successfully as below:28.JPG

 

29.JPG

 

Note: The File name dynamic content the "When a file is created in a folder" trigger (The trigger within your flow) returned as below:30.JPG

 

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
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

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Flow does not recognize filename or file extension of pdf file it just created in a condition

Hello Kris

 

thanks for the reply and suggestion. I played around yesterday evening a bit more and found the reason for the unexpected behavior. And indeed, it is linked to the trigger.

 

The condition fails because the dynamic value "FileName"  somehow returns the encoded file name, not the normal one.

Why this happens, I don't understand. 

 

TriggerOutputEncoded 5-1-2018 12-33-29 PM.png

 

It is not very helpful that the dynamic value "FileName" can actully mean 2 different entities.
Maybe the dynamic content naming can be improved and the value 'x-ms-name' (Display name?) included in the trigger output.

 

SOLUTION: I got the flow to work as expected by changing the value 'x-ms-name-encoded' to 'x-ms-name'.

 

Last comment - your work around is a SOLUTION as well as yet involves additional steps

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Flow does not recognize filename or file extension of pdf file it just created in a condition

Hi @ErichH,

 

I think there is something wrong with the trigger within your flow, I have made a test on my side and please take a try with the following workaround:

  • Add a "When a file is created (properties only)" action, specify Site Address and Library Name.
  • Add a Condition, left input box set to File name with extension dynamic content of the trigger, right input box set to .pdf, within middle drop down, choose contains.
  • Within "If/yes" branch of Condition, add a "Send me an email notification" action.
  • Within "If/no" branch of Condition, add a "Get file content" action of SharePoint connector, File Identifier field set to Identifier dynamic content of the trigger.

         Add a "Create file" action, specify Folder Path, File Name set to File name with extension dynamic content of the trigger, File Content set to File Content dynamic content of the "Get file content" action (above action). 

        Add a "Convert file" action, File field set to Id dynamic content of the "Create file" action, Target Type set to PDF.

        Add a "Create file 2" action, specify Folder Path, File Name field set to File name dynamic content of the "Convert file" action, File Content field set to File content dynamic content of the "Convert file" action.

        Add a "Get file content 2" action of OneDriver connector, File field set to Id dynamic content of the "Create file 2" action.

        Add a "Create file 3" action of SharePoint connector, specify Site Address and Folder Path, File Name set to Display name dynamic content of the "Create file 2" action, File Content set to File content dynamic content of the "Get file content 2" action.

 

Image reference:25.JPG

 

26.JPG

 

27.JPG

The flow works successfully as below:28.JPG

 

29.JPG

 

Note: The File name dynamic content the "When a file is created in a folder" trigger (The trigger within your flow) returned as below:30.JPG

 

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
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

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Flow does not recognize filename or file extension of pdf file it just created in a condition

Hello Kris

 

thanks for the reply and suggestion. I played around yesterday evening a bit more and found the reason for the unexpected behavior. And indeed, it is linked to the trigger.

 

The condition fails because the dynamic value "FileName"  somehow returns the encoded file name, not the normal one.

Why this happens, I don't understand. 

 

TriggerOutputEncoded 5-1-2018 12-33-29 PM.png

 

It is not very helpful that the dynamic value "FileName" can actully mean 2 different entities.
Maybe the dynamic content naming can be improved and the value 'x-ms-name' (Display name?) included in the trigger output.

 

SOLUTION: I got the flow to work as expected by changing the value 'x-ms-name-encoded' to 'x-ms-name'.

 

Last comment - your work around is a SOLUTION as well as yet involves additional steps

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Users online (6,199)