I have a flow that iterates through attachments in a Sharepoint list item and stores the file content in an array variable called "attachmentsToMerge" . If the array has more than 1 item, it calls a service to merge them and then the service returns the result in a "PDF File Content" that I can use to create the file in Sharepoint. If the array attachmentsToMerge only has 1 item, I use the following expression to get the first stored file content to create the file in Sharepoint: first(variables('AttachmentsToMerge')). This work when I use a "Create file" action in each separate branch of the "yes/no" control.
Ideally, I'd like to store whatever is returned in each one of the branches (either "PDF File Content" or what I get from the 'first' expression) and use the variable as the File Content to add to the "create file in Sharepoint" action, to be used after the yes/no control.
Ideal placement of "Create file in Sharepoint" action
The File Content in the "create file" action only seems to accept a string variable. I tried storing the result of either branch in a string variable (see variable "mergedFileContent" in snapshot) and used it in a "create file" and it didn't really worked. I'm only using PDFs file content, and the stored file content seems to pass some metadata to the "create file" action, as I can see for instance the right number of pages, but the content is blank.
I read the post "Store File Content in a variable" but it seems to apply only to File Content in emails. A user had a similar issue a mine, but that other post was unanswered. I would appreciate help on how to resolve this.
User | Count |
---|---|
88 | |
43 | |
21 | |
18 | |
16 |
User | Count |
---|---|
132 | |
47 | |
42 | |
36 | |
28 |