Hello All,
I need some help with attaching PDF file to email using OAuth2.0 method.
I have no issue with attach simple plain text file to the email. But unable to attach the PDF (encoded to base64). The program just crashed.
I followed the sample code from the Microsoft link below.
user: sendMail - Microsoft Graph v1.0 | Microsoft Learn
"attachments": [ { "@odata.type": "#microsoft.graph.fileAttachment", "name": "attachment.txt", "contentBytes": "SGVsbG8gV29ybGQh" }
Since the "contentBytes" expects the content to be encoded to base64.
I tried to pass in the SetBody() as String and Blob. Both failed.
OAuthRequest objects
Syntax
objectname.SetBody ( string data )
objectname.SetBody ( blob data )
Any help would be greatly appreciated.
Thanks,
Kevin