Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exchange FindItem responding with different set of properties for one item id and for multiple item ids

When I loading properties of multiple exchange items by ExchangeService.LoadPropertiesForItems method, Exchange skip some properties of items attachments in response:

<t:CalendarItem>
  <t:ItemId Id="itemId" ChangeKey="itemChangeKey"/>
  <t:Subject>Test appointment</t:Subject>
  <t:Attachments>
    <t:FileAttachment>
      <t:AttachmentId Id="firstAttachmentId"/>
      <t:Name>pdf.pdf</t:Name>
      <t:Size>94150</t:Size>
      <t:LastModifiedTime>2015-08-03T10:54:40</t:LastModifiedTime>
      <t:IsInline>false</t:IsInline>
      <t:IsContactPhoto>false</t:IsContactPhoto>
    </t:FileAttachment>
    <t:FileAttachment>
      <t:AttachmentId Id="secondAttachmentId"/>
      <t:Name>ATT89202</t:Name>
      <t:Size>3803738</t:Size>
      <t:LastModifiedTime>2015-12-03T16:40:46</t:LastModifiedTime>
      <t:IsInline>true</t:IsInline>
    </t:FileAttachment>
  </t:Attachments>
</t:CalendarItem>

As you can see, in response above not included ContentId property. But when I use Load method of Item class for loading properties of single item, EWS Managed API generates the same GetItem SOAP request with single item id and Exchange responding with extended set of attachments properties:

<t:CalendarItem>
  <t:ItemId Id="itemId" ChangeKey="itemChangeKey"/>
  <t:Subject>Test appointment</t:Subject>
  <t:Attachments>
    <t:FileAttachment>
      <t:AttachmentId Id="firstAttachmentId"/>
      <t:Name>pdf.pdf</t:Name>
      <t:ContentId>25F20E449DEC42B67EB3DE58C51E56E3BE0B27F5@1</t:ContentId>
      <t:Size>94150</t:Size>
      <t:LastModifiedTime>2015-08-03T10:54:40</t:LastModifiedTime>
      <t:IsInline>false</t:IsInline>
      <t:IsContactPhoto>false</t:IsContactPhoto>
    </t:FileAttachment>
    <t:FileAttachment>
      <t:AttachmentId Id="secondAttachmentId"/>
      <t:Name>ATT89202</t:Name>
      <t:ContentId>DB969CA378C5F9565E98779626E3BCA3A65FB275@1</t:ContentId>
      <t:Size>3803738</t:Size>
      <t:LastModifiedTime>2015-12-03T16:40:46</t:LastModifiedTime>
      <t:IsInline>true</t:IsInline>
    </t:FileAttachment>
  </t:Attachments>
</t:CalendarItem>

As you can see, in the second response ContentId property presented Moreover, when I use ExchangeService.LoadPropertiesForItems method, passing in single item as the first argument, Exchange also include Attachment.ContentId property into response.

Is there a way I can get ContentId properties of items attachments without loading properties for all items separately?

like image 466
Yuriy Rozhovetskiy Avatar asked Dec 08 '15 11:12

Yuriy Rozhovetskiy


1 Answers

You could use ExchangeService.BindToItems method. It returns a comprehensive set of attachment properties.

See ExchangeService.BindToItems

like image 56
cookiemonster Avatar answered Nov 12 '22 08:11

cookiemonster