How to send a message reply with attachments

Anonymous
2023-03-29T06:19:47.2833333+00:00

Is it possible to add attachments when using "message reply"?

We send replies on an message using the message reply statement below:

"POST /users/{id | userPrincipalName}/mailFolders/{id}/messages/{id}/reply"

Now we also would like to send attachments with our replies. Is it possible in the same post statement, or is there an other way to do this?

Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

Accepted answer
  1. Gopinath Chennamadhavuni 2,446 Reputation points
    2023-03-29T06:59:46.0566667+00:00

    Hi @TWS

    I'm glad to hear you solve the problem, if you have any issue about MS Graph Booking, you are welcome to raise a ticket in this forum.

    By the way, since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others." and according to the scenario introduced here: Answering your own questions on Microsoft Q&A, I would make a brief summary of this thread:

    How to send a message reply with attachments

    Solution:

    Providing the file details under attachments property in request payload, able to send the attachments while replying to the message using MS Graph API.

    {
      "message": {
        "subject": "Test reply",
        "toRecipients":[
          {
            "emailAddress": {
              "address":"******@test.com",
              "name":"name"
            }
          }
         ],
    	"attachments": [
          {
            "@odata.type": "#microsoft.graph.fileAttachment",
            "name": "attachment1.txt",
            "contentType": "text/plain",
            "contentBytes": "SGVsbG8gV29ybGQh"
          },
          {
            "@odata.type": "#microsoft.graph.fileAttachment",
            "name": "attachment2.txt",
            "contentType": "text/plain",
            "contentBytes": "SGVsbG8gV29ybGQh"
          }	  
        ]	
        },	
        "comment": "reply 123456"
    }
    
    

    You could click the "Accept Answer" button for this summary to close this thread, and this can make it easier for other community members to see the useful information when reading this thread. Thanks for your understanding!

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2023-03-29T06:32:19.2033333+00:00

    Already found the answer. Simply by adding then to the json as shown below

    {
      "message": {
        "subject": "Test reply",
        "toRecipients":[
          {
            "emailAddress": {
              "address":"******@test.com",
              "name":"name"
            }
          }
         ],
    	"attachments": [
          {
            "@odata.type": "#microsoft.graph.fileAttachment",
            "name": "attachment1.txt",
            "contentType": "text/plain",
            "contentBytes": "SGVsbG8gV29ybGQh"
          },
          {
            "@odata.type": "#microsoft.graph.fileAttachment",
            "name": "attachment2.txt",
            "contentType": "text/plain",
            "contentBytes": "SGVsbG8gV29ybGQh"
          }	  
        ]	
        },	
        "comment": "reply 123456"
    }
    
    0 comments No comments

  2. Juhre, Michael 0 Reputation points
    2023-05-11T15:21:50.1533333+00:00

    Am I really to understand that to enable "reply all with original attachments," someone has to add a JSON file to our Office build? That will certainly never happen in an org my size.

    MS Office has a million features no one uses, and this is not built in as a native option to toggle on and off somewhere in mail settings? I can't decide whether to ... not believe this ... or just accept it as par for the course per MS.

    :|

    OK, I'm glad I decided not to believe this. I just opened the message, right clicked the orignal attachment and copied it, hit Reply All and then right-click paste and there is my attachment.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.