I'd like to pass a variable of type File from Copilot Studio (CPS) to a Power Automate (PA) flow. While CPS does allow attachments, and these can be stored in a variable of type file, and PA does allow creation of an input of type "File" from CPS, their types don't match.
Process:
* When the user clicks on the paperclip icon in a CPS chat session then uploads a file, an event is fired and the system variable System.Activity.Attachments.Value holds the actual binary content of the uploaded file.
* When assigning this to a variable, the variable takes on the type of "File" and does contain the binary content. It looks like it's Base64 encoded.
* Next I created a PA flow from CPS to accept this File as an input. In the PA flow I selected an input variable with type "File" then in CPS I try to pass through my File variable.
This is the error I get:
As you can see, CPS thinks that PA is expecting an input of type "Record" not "File" as I had specified.
OK, so let's change that variable to the Record that contains the file attachment and see if that helps....
Good - It works in the CPS editor - the variable types now match, but I get this error at runtime:
So IMHO Power Automate should not allow you to specify an input type of File as it does not work from CPS.
I've tried converting the File variable in CPS to a string - using the JSON function (JSONformat.IncludeBinary does not work), and string functions like Mid (errors with BlobtoText is not implemented at run time) however these approaches don't work.
Next attempt will be to hand off the conversion by POSTing to an HTTP hosted helper function to convert to something else. However this in itself also seems to have similar type conversion issues.
Any ideas would be welcome.
THanks --doug