Hi @Akila R ,
We can send PDFs Encrypt with Password, following example snippet shows how I am able to use /me/sendMail
send a PDF file that is password protected.
In message
body attachments
property contentBytes
we should pass Base64Encoded string.
POST https://graph.microsoft.com/v1.0/me/sendMail
Content-type: application/json
{
"message": {
"subject": "Send Mail with encrypted PDF",
"body": {
"contentType": "Text",
"content": "Attached PDF is a password protected."
},
"toRecipients": [
{
"emailAddress": {
"address": "{emailAddress}"
}
}
],
"attachments": [
{
"@odata.type": "#microsoft.graph.fileAttachment",
"name": "secured.pdf",
"contentType": "application/pdf",
"contentBytes": "{Base64EncodedString}"
}
]
}
}
Here is the results of my test, in the below screenshots secured.pdf
is a password protected file.
For this test I used a online free Base64Encoding tool to upload the file and that generates the Base64Encoded string.
Please note sendmail on the fly with file Attachment, can support upto 3MB of file. As content is sent in the Base64Encoded string. For sending larger files with size more than 3MB consider using outlook-large-attachments.
Hope this helps.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".