GetAttachment doesn’t get Size of the attachment

For those, who don't use Exchange Web Services API, but bank on its Requests and Responses.

An email message has a attachment table that contains the attachments, and these in turn contain the properties such as PR_ATTACH_SIZE, PR_ATTACH_DATA_BIN etc. This means that email message doesn't have any of the attachment properties on it.

The GetItem could be used to get the all the properties of an email message, the extended properties being got by PathToExtendedFieldType.

The GetAttachment doesn't get the PR_ATTACH_SIZE MAPI Property when being given the Attachment ID. The size could be found by using the Length property of the Content fetched in the byte array.

This is also validated with PathToExtendedFieldType, which when usen in GetAttachment request doesn't send back the PR_ATTACH_SIZE.

GetAttachmentType getAttachmentRequest = new GetAttachmentType();
getAttachmentRequest.AttachmentShape = new AttachmentResponseShapeType();
PathToExtendedFieldType pteftFlagStatus = new PathToExtendedFieldType();
pteftFlagStatus.PropertyTag = "0x0E20"; // Tag of PR_ATTACH_SIZE
pteftFlagStatus.PropertyType = MapiPropertyTypeType.Long;

<?xml version="1.0"?>
  <GetAttachmentType xmlns:xsi="" xmlns:xsd="">
    <AttachmentShape xmlns="">
      <AdditionalProperties xmlns="">
        <ExtendedFieldURI PropertyTag="0x0E20" PropertyType="Long" />
    <AttachmentIds xmlns="">
    <AttachmentId Id="AAAaAEFkbWluaXN0cmF0b3JAZGMxMjkw...</AttachmentIds>

<?xml version="1.0"?>
  <GetAttachmentResponseType xmlns:xsi="" xmlns:xsd="">
    <ResponseMessages xmlns="">
      <GetAttachmentResponseMessage ResponseClass="Success">
           <FileAttachment xmlns="">
             <AttachmentId Id="AAAaAEFkbWluaXN0cmF0b3JAZG...<Name>smime.p7m</Name>

There we go. The response doesn't yield the Extended Field type property.
Hence, the theorem.


Comments (0)

Skip to main content