OP here on a different account.
Been working on this without success and think I have a breakthrough.
Summary of issues:
MS Graph small file upload works but file is corrupted.
MS Graph resumable large file upload errors out (no code) if I add Content-Length header. If I miss it out, I get response from Graph that header is missing.
I realised there is one casue for all this. Deluge invokeurl function is inserting a header and footer in to the byte stream. When I remove that after upload, the file opens normally.
59 bytes at the beginning:
--kH7EE3nxZTAn4hcySXH7cXXpau29ZC70XTWLHl
Content-Disposition: form-data; name="content"; filename="Isabelle blank prescription.docx"
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Content-Transfer-Encoding: binary
46 bytes at the end:
--kH7EE3nxZTAn4hcySXH7cXXpau29ZC70XTWLHl--
This is why it works fine in Postman but not Zoho Deluge. I'm unsure how to proceed but seems its a fault in Deluge. However I have now seen this is a problem on other platforms.
Any ideas would be welcome!