简体   繁体   中英

How to retrieve extended properties for calendar event (by name)?

I have an Exchange calendar populated though Exchanges Web Services (EWS) UpdateItem SOAP calls containing:
(Example here for an integer TTID and a TTSyncID string field)

 <mes:UpdateItem ConflictResolution="AlwaysOverwrite" SendMeetingInvitationsOrCancellations="SendToNone">
    <mes:ItemChanges>
       <typ:ItemChange>
          <typ:ItemId Id="%s" ChangeKey="%s" />
          <typ:Updates>
             <typ:SetItemField>
                <typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TTID" PropertyType="Integer"/>
                <typ:CalendarItem>
                   <typ:ExtendedProperty>
                      <typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TTID" PropertyType="Integer"/>
                      <typ:Value>10</typ:Value>
                   </typ:ExtendedProperty>
                </typ:CalendarItem>
             </typ:SetItemField>
            <typ:SetItemField>
               <typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TTSyncID" PropertyType="String"/>
               <typ:CalendarItem>
                  <typ:ExtendedProperty>
                     <typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="%s" PropertyType="String"/>
                     <typ:Value>SomeStringData</typ:Value>
                  </typ:ExtendedProperty>
               </typ:CalendarItem>
            </typ:SetItemField>
          </typ:Updates>
       </typ:ItemChange>
    </mes:ItemChanges>
 </mes:UpdateItem>

In EWS they came back in the GetItem SOAP requests as

  <ExtendedProperty>
    <ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TTID" PropertyType="Integer"/>
    <Value>10</Value>
  </ExtendedProperty>
  <ExtendedProperty>
    <ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TTSyncID" PropertyType="String"/>
    <Value>SomeStringData</Value>
  </ExtendedProperty>

I'm now trying to retrieve these with the other event properties through Postman calls to the MS Graph API.

From what I understand I have to use Outlook extended properties and not Open extensions to keep this backward compatible (correct me if I'm wrong).

But I can't get this to work, because the singleValueExtendedProperties expansion seems to insist on MAPIPropertyTpes and GUIDs. If I call

https://graph.microsoft.com/v1.0/users/{{UserID}}/calendar/events/{{TTSyncedEventID}}?$expand=singleValueExtendedProperties($filter=id eq '{{extensionID}}')

with {{extensionID}} = TTSyncID or TTID , I get

{
  "error": {
    "code": "ErrorInvalidProperty",
    "message": "PropertyId values may only be in one of the following formats: 'MapiPropertyType namespaceGuid Name propertyName', 'MapiPropertyType namespaceGuid Id propertyId' or 'MapiPropertyType propertyTag'."
  }
}

Can I somehow retrieve these namespaceGuid and use those (as suggested here ?
Is there an easier way referencing the properties with the human-readable TTSyncID or TTID ?

You can look at existing messages with these properties set with MFCMAPI or OutlookSpy (I am its author, click IMessage button to see Extended MAPI properties). In OutlookSpy you can also construct a Graph query and specify any MAPI property (fixed or named) - click Message button in the Graph group on the OutlookSpy ribbon, click "Query Parameters", check "$expand" checkbox, click on the button next to the edit box.

In your particular case, the query would most likely be

singleValueExtendedProperties($filter=id eq 'String {00020329-0000-0000-C000-000000000046} Name TTSyncID')

在此处输入图像描述

Based on this , namespace GUID for public strings property sets is {00020329-0000-0000-C000-000000000046} .

If you use the following form of URL

https://graph.microsoft.com/v1.0/users/{{UserID}}/calendar/events/{{TTSyncedEventID}}?$expand=singleValueExtendedProperties($filter=id eq 'MapiPropertyType namespaceGuid Name propertyName')

You should be able to get the value of TTID property

https://graph.microsoft.com/v1.0/users/{{UserID}}/calendar/events/{{TTSyncedEventID}}?$expand=singleValueExtendedProperties($filter=id eq 'Integer {00020329-0000-0000-C000-000000000046} Name TTID')

and get the value of TTSyncID property

https://graph.microsoft.com/v1.0/users/{{UserID}}/calendar/events/{{TTSyncedEventID}}?$expand=singleValueExtendedProperties($filter=id eq 'String {00020329-0000-0000-C000-000000000046} Name TTSyncID')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM