Got an error: Unable to read data from the transport connection when trying to get the MIME content of a Outlook message which has more than 25MB size attachments

Piyumi Perera 121 Reputation points
2022-09-13T04:35:35.49+00:00

I am having a requirement to send an email by attaching an eml file using Graph API. To attach the eml file, I have to get the Mime content of the selected message.
I am using following code sample to get the Mime content of a message item.

  var content = await _graphServiceClient.Users[mailboxAddress].Messages[mailItemId].Content.Request().GetAsync();  

Above code works fine if the attachment size is less than 25MB.
If attachment is more than 25MB, I am getting following error response.

240371-image.png

I need some recommended way to get the mime content of large message items.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,866 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,858 questions
0 comments No comments
{count} votes

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.