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
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (1,465)