How to get a value equivalent to the RFC22 size of an entire email message by using Microsoft Graph API?

Admin Shuttlecloud 0 Reputation points

I’d like to know how possible is to get a value equivalent to the RFC822 size of an entire email message by using Microsoft Graph API.

The RFC822 size is defined as “RFC822.SIZE is the number of octets in the message when the message is expressed in [RFC5322] format” (see reference). The most similar field returned by MS Graph API I was able to find is the PidTagMessageSize (see reference), which “Contains the sum, in bytes, of the sizes of all properties on a message object.“.

IMAP allows the possibility of obtaining the RFC822 size directly with the FETCH command. See:

1 FETCH (FLAGS (\Seen) RFC822.SIZE 1910 BODY[HEADER.FIELDS ("MESSAGE-ID")] {60} Message-ID: <8984267.1075855214866.JavaMail.evans@thyme>
) . OK Success

To get the PidTagMessageSize with Graph API, the singularValueExtendedProperty 0x0E08 has to be included explicitly in the query. See screenshot attached.


These are examples for the same email message (check the Message-ID is the same in both IMAP / Graph API cases). However, the RFC822 size returned by IMAP is 1910 which is different than the value returned by Graph API which is 6116 (see in the response in the screenshot { “id”: “Long 0xe08”, “value”: “6116” }).

Is there a way to get the same value IMAP returns, i.e. RFC822 size, by using Graph API or at least a unique relation that can be applied in order to calculate that size form the value returned by GraphAPI, i.e. PidTagMessageSize?

Thank you

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,935 questions
0 comments No comments
{count} votes