Forum Discussion

Dawid van Heerden's avatar
Dawid van Heerden
Brass Contributor
Mar 21, 2023

OneNote create page with multipart/form-data - The multi-part payload was malformed.

Good day,   I am trying to create a OneNote page using the Graph OneNote endpoint below, but can't seem to get the multipart right and keep on getting an error that "The multi-part payload was malf...
  • Dawid van Heerden's avatar
    Mar 28, 2023

    After working with Microsoft to resolve, it turns out that the Power Automate UI has a tendency to strip out \r aka CR (Carriage Return) aka %0D characters whereas the OneNote API is very picky and requires CRLF end of line characters, so we need to sub LF back in. And the replacement should be in the HTTP action body or there is a good chance they get striped out again and it fails.

     

    If variables(strBody) is your payload;

     

    Content-Length == length(replace(variables('strBody'),uriComponentToString('%A'),uriComponentToString('%0D%A')))

     

    Body == replace(variables('strBody'),uriComponentToString('%0A'),uriComponentToString('%0D%0A'))

     

     

     

     

     

     

     

     

Resources