none
Get EntryId from FindItem method with EWS web service RRS feed

  • Question

  • Hi,

    Is it poosible to get EntryId instead of ItemId with the FindItem request? Im consuming the service with the XML constructed in a not well known code. 

    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" 
        xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" 
        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Header>
        <t:RequestServerVersion Version="Exchange2013_SP1" />
      </soap:Header>
      <soap:Body>
        
        <m:FindItem Traversal="Shallow">
          <m:ItemShape>       
          <t:BaseShape>AllProperties</t:BaseShape>
            <t:AdditionalProperties>
            <t:FieldURI FieldURI="item:ItemId" />
              <t:FieldURI FieldURI="item:Subject" />
              <t:FieldURI FieldURI="item:DateTimeReceived" />
              <t:FieldURI FieldURI="message:From" />          
            </t:AdditionalProperties>
          </m:ItemShape>
          <m:IndexedPageItemView MaxEntriesReturned="10" Offset="0" BasePoint="Beginning" />
          <m:Restriction>
            <t:And>
              <t:Contains ContainmentMode="Substring" ContainmentComparison="IgnoreCase">
                <t:FieldURI FieldURI="item:Subject" />
                <t:Constant Value="1248390" />
              </t:Contains>
            </t:And>
          </m:Restriction>
          <m:SortOrder>
            <t:FieldOrder Order="Descending">
              <t:FieldURI FieldURI="item:DateTimeReceived" />
            </t:FieldOrder>
          </m:SortOrder>
          <m:ParentFolderIds>
           <t:DistinguishedFolderId Id="inbox" />
            <t:DistinguishedFolderId Id="sentitems" />
            <t:FolderId Id="AQEuAAADGkRzkKpmEc2byACqAC/EWgMAHKJyWr2NVUOldo1zaf51NQAAAh9qAAAA"/>
          </m:ParentFolderIds>
        </m:FindItem>
      </soap:Body>
    </soap:Envelope>

    Monday, June 10, 2019 1:36 PM

Answers

  • Yes both those methods return that format, eg in finditems when you access the property results its just base64 encoded bytearray. So decode the Base64 and then convert the bytearray to Hex which is easy in most languages.

    Cheers
    Glen

    • Marked as answer by Ollza Wednesday, June 12, 2019 7:02 AM
    Wednesday, June 12, 2019 1:45 AM

All replies

  • You can request the Entryid as an Additional property using the Extended property definition for pidTagEntryId https://docs.microsoft.com/en-us/office/client-developer/outlook/mapi/pidtagentryid-canonical-property   eg

      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        <soap:Header>
          <t:RequestServerVersion Version="Exchange2013" />
        </soap:Header>
        <soap:Body>
          <m:GetFolder>
            <m:FolderShape>
              <t:BaseShape>AllProperties</t:BaseShape>
              <t:AdditionalProperties>
                <t:FieldURI FieldURI="folder:DisplayName" />
                <t:FieldURI FieldURI="folder:ChildFolderCount" />
                <t:FieldURI FieldURI="folder:FolderClass" />
                <t:FieldURI FieldURI="folder:ManagedFolderInformation" />
                <t:FieldURI FieldURI="folder:TotalCount" />
                <t:FieldURI FieldURI="folder:UnreadCount" />
                <t:ExtendedFieldURI PropertyTag="4095" PropertyType="Binary" />
              </t:AdditionalProperties>
            </m:FolderShape>
            <m:FolderIds>
              <t:FolderId Id="AAMkADczNDE4YWEwLTdlZmIY...." />
            </m:FolderIds>
          </m:GetFolder>
        </soap:Body>
      </soap:Envelope>


    or just use the ConvertId operation to convert the ItemId to the EntryId https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/convertid-operation

    Cheers
    Glen

    Tuesday, June 11, 2019 12:36 AM
  • Ok, Thanks. Is it posible to get it in below HEX form? I will use it to reply the object with Outllok Application and GetItemFromId

    "000000001A447390AA6611CD9BC800AA002FC45A09001CA2725ABD8D5543A5768D7369FE7535000000001F6A00003326DC860079684C9F816E8BE55C865F00042AE480FE0000"
    • Edited by Ollza Tuesday, June 11, 2019 12:21 PM
    Tuesday, June 11, 2019 6:33 AM
  • Yes both those methods return that format, eg in finditems when you access the property results its just base64 encoded bytearray. So decode the Base64 and then convert the bytearray to Hex which is easy in most languages.

    Cheers
    Glen

    • Marked as answer by Ollza Wednesday, June 12, 2019 7:02 AM
    Wednesday, June 12, 2019 1:45 AM
  • Ok. In the language i use it is not possible so thats why i hoped there was a way to get it in hex directly.

    But i just do a external prog i .net or somethning.

    Thanks

    Wednesday, June 12, 2019 7:02 AM