0

I'm trying to create a .zip file by passing the returned body of an HTTP GET request to SharePoint's Create File.

Body is:

{
  "$content-type": "application/zip",
  "$content": "UEsDBBQACA...="
}

Shouldn't this just work? The docs only define the Create File field as "Content of the file." but that's not super informative...

I believe I've done this before with a file that was application/pdf and it worked. Unfortunately, I can't find that Logic App (I think it may have been an experiment I've since deleted).

I should note that the Create File action does create a valid .zip file, in that it's not corrupt, but archive is empty. It's supposed to contain a single .csv file.

I tried decoding the Base64 content and it's definitely binary data.

Any idea where I'm going wrong?

1 Answer 1

0

I test with Postman and when I use the form-data way to POST the request, I found the .zip file couldn't be open. Then I check the Logic App run history and I find the problem is if just use the triggerbody() as the file content it will fail.

This is because the triggerbody() not just have the $content, so I change the expression to triggerBody()['$multipart'][0]['body'] then it works and the .zip file is full. enter image description here

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

I believe the file I am being given by the 3rd party is the problem. Using 7-Zip File Manager I am able to open the ZIP to see that there is an unnamed folder wrapping the CSV file I'm trying to get. So when Windows opens the ZIP and I see an empty directory it's because it doesn't know what to do with the unnamed folder. 7-Zip is a little more flexible and lets me open that folder to find the file I'm looking for. Unless you have another idea, I don't think there's anything I can do but contact them to see if they will fix this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.