California Consumer Privacy Act (CCPA) Opt-Out Icon by info.odysseyx@gmail.com October 21, 2024 written by info.odysseyx@gmail.com October 21, 2024 0 comment 1 views 1 background For sending multi-part/form data content in Logic App, there is official documentation that introduces how to achieve this. Create a workflow that calls an external endpoint or other workflow – Azure Logic Apps | Microsoft rear…. But recently, if we Content processing If the file name section contains non-ASCII characters (Chinese, Japanese characters), the file name is displayed as ????. If you implement Http operations according to the documentation. machine through testing curl There is an alternative way to send multipart/form-data by encoding all payloads as base64 encoded strings using the command: Here’s a sample payload sent from CURL: { "$content-type": "multipart/form-data; boundary=------------------------boundary", "$content": "base64 encoded content" } The decoded base64 string is in the usual multipart/form-data format. --------------------------boundary Content-Disposition: form-data; name="filename"; filename="[File name]" Content-Type: application/octet-stream File content binary --------------------------boundary-- avatar Depending on the mechanism, you will see that it is also possible to send multi-part forms using Logic App Http actions using the same format.o The only obstacle is how to combine the border header, file binary and border footer into a single base64 string. In most situations we get the file contents as separate base64 strings. As we all know, you can’t concatenate multiple base64 strings directly, so decoding may be wrong. So, we first need to convert all three parts to binary and combine them into a single byte.[]Then convert it all together to a base64 string. There is no built-in expression/function to handle this. As a workaround, you can prepare three base64 encoded strings (boundary header, file content and border footer) and then use the new feature “C# inline” to achieve this approach. Here is sample code: // Add the required libraries #r "Newtonsoft.Json" #r "Microsoft.Azure.Workflows.Scripting" using System; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Primitives; using Microsoft.Extensions.Logging; using Microsoft.Azure.Workflows.Scripting; using Newtonsoft.Json.Linq; public static async Task Run(WorkflowContext context, ILogger log) { var fileContent = (await context.GetActionResults("FileContent").ConfigureAwait(false)).Outputs; string header = (await context.GetActionResults("BoundaryHeader").ConfigureAwait(false)).Outputs; string footer = (await context.GetActionResults("BoundaryFooter").ConfigureAwait(false)).Outputs; byte[] headerBinary = Convert.FromBase64String(header.ToString()); byte[] footerBinary = Convert.FromBase64String(footer.ToString()); byte[] fileContentBinary = Convert.FromBase64String(fileContent.ToString()); List allBytes = new List(); allBytes.AddRange(headerBinary); allBytes.AddRange(fileContentBinary); allBytes.AddRange(footerBinary); string base64Content = Convert.ToBase64String(allBytes.ToArray()); return new Results { Message = base64Content }; } public class Results { public string Message {get; set;} } After you get the output from your C# action, you can configure it all into an Http action. Source link Share 0 FacebookTwitterPinterestEmail info.odysseyx@gmail.com previous post How Microsoft Learn Student Ambassador Program Transformed me next post Why and how Lenovo is dominating the field of AI You may also like A New Dawn of Software Defined Networking (SDN) in Windows Server 2025 November 5, 2024 Get AI ready: Empowering developers in the era of AI November 5, 2024 Announcing the General Availability of Windows Server IoT 2025! November 5, 2024 America’s Partner Blog | Partners Make More Possible: Education November 4, 2024 Turn Microsoft Copilot into a personal assistant with Scheduled Prompts November 4, 2024 Sync identities from Rippling to Microsoft Entra ID November 4, 2024 Leave a Comment Cancel Reply Save my name, email, and website in this browser for the next time I comment.