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

1

12

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?

Conjoint answered 8/12, 2015 at 11:4 Comment(2)
have you tried service.LoadPropertiesForItems(items, PropertySet.FirstClassProperties);?Flocky
@kienct89 yes, I tried. The same result - if there is single item in collection, Exchange responding with ContentId property of inline attachments. If there are more than one item passed in, ContentId does not returned for attachments of all items.Conjoint
W
2

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

See ExchangeService.BindToItems

Wavellite answered 9/12, 2015 at 6:1 Comment(2)
The same result - ContentId property not returnedConjoint
Maybe you could try the EWS GetAttachment operation so you can send a list of all attachement ids you want to load together. I realize it is not exactly what you want but it beats making multiple calls for each attachment you retrieve. Hopefully it works.Wavellite

© 2022 - 2024 — McMap. All rights reserved.