cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FJ1200
Frequent Visitor

Flow using Get file content fails in an Apply to all loop

Hi – I have been struggling for a long time with a flow that I really need assistance with getting content of a file within an Apply to all loop.  Should work but it doesn’t and I can’t work out why.  JSON Button manualy triggered in a SP list.

 

I need to pull a specific PowerPoint file from a Project Docs folder and merge with a Word doc using the Encodian Merge to PDF.  The Word doc works perfectly but a PowerPoint file does not.   I have to search for the pptx file, but there should only ever be one per project and we will be using use a (yet to be agreed) naming convention.  I have a view in the Library to isolate that project document type (not document extension type, btw).  So I have this procedure:

 

FJ1200_0-1627025605567.png

 

  • Get Files (Properties Only) – Limited by the Library View above
  • Filter Array – Value from above filtered by ProjectID – produces a single file – all works so far.
  • Apply to each – this where the issue is – Output of previous step - Body(Filter_Array)
    • Get file metadata – uses expression  items(‘Apply_to_each’)?[‘{Identifier}’]
    • Get File Content - uses expression  items(‘Apply_to_each’)?[‘{Identifier}’]
    • Append to array variable: - uses json:

 

{
  "fileName": @{variables('varFullPath')}, <-Tried all sorts here
  "fileContent": @{body('Get_file_content')?['body']}
}

 

This is where I get the problem.  When I run it, in the output the {Identifier} value is correct, but in the JSON input for the Encodian merge the filename is just the filename, not the full path, and the content is Null.

 

As well as the {Identifier} value I’ve tried FullPath and almost any other option  I think might work, and currently have the Identifier in a variable to save typing it out every time - but it always comes back the same.  The header section of the output is as follows:

 

 

 

"host": {
        "connectionReferenceName": "shared_encodiandocumentmanager",
        "operationId": "MergeArrayOfDocumentsToPdf"
    },
    "parameters": {
        "operation/outputFilename": "MergedDoc.pdf",
        "operation/documents": [
            {
                "fileName": "12345-ABC.pptx",
                "fileContent": null
            },
            {
                "fileName": "TempDummyProjjectDoc.docx",
                "fileContent": {
                    "$content-type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
                    "$content": "UEsDBBQABgAIAAAAIQAJbKF4DQIAAGkPAAATAAg……  

 

 

The Word doc bit is fine.

I’m now wondering would I be better to just copy it to ODfB, convert to PDF then merge that and the Word doc?  According to the Encodian videos this should work as-is.  Does anyone have any suggestions?  I think I'm missing something really basic here.

1 REPLY 1
FJ1200
Frequent Visitor

So I sort of have this working now thanks to Jay at Encodian, but it pulled out more than one file, so now struggling with the Get File (Properties only) filtering.  I need to pull just one pptx file.  Standard naming convention - <projectid>-<filetype>.<extn>.  So I have tried:

 

startswith(FileLeafRef,'<projectid>')  - fails 

substringof('<projectid>',FileLeafRef) - fails

substringof('<filetype>',FileLeafRef) - fails

endswith(FileLeafRef,'<pptx>') - fails

 

In fact everything I try fails.  I can't see anything I'm doing wrong here.  According to the docs, the forums, everywhere I look this should work but does not.  Any ideas anyone?

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (2,172)