2012-04-25 39 views
1

我想設置一個現有任命爲業主的項目,我使用類似下面的XML請求到:EWS:不斷變化的主人現有約會

<ns1:UpdateItem xmlns:ns1="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/types" ConflictResolution="AlwaysOverwrite" SendMeetingInvitationsOrCancellations="SendToNone"> 
    <ns1:ItemChanges> 
     <ns2:ItemChange> 
      <ns2:ItemId Id="AAMkADY1ZDIwNjM1LTU4MjAtNGQy...ogbn8LT58s6MSx+1IiAZWtaUhFAACF1Gogbn8LT58s6MSx+1IiAZ3GKIJbAAA=" ChangeKey="DwAAABYAAACF1Gogbn8LT58s6MSx+1IiAZ3HHOPj"/> 
      <ns2:Updates> 
       <ns2:SetItemField> 
        <ns2:ExtendedFieldURI DistinguishedPropertySetId="Appointment" PropertyId="33321" PropertyType="Boolean"/> 
        <ns2:CalendarItem> 
         <ns2:ExtendedProperty> 
          <ns2:ExtendedFieldURI DistinguishedPropertySetId="Appointment" PropertyId="33321" PropertyType="Boolean"/> 
          <ns2:Value>true</ns2:Value> 
         </ns2:ExtendedProperty> 
        </ns2:CalendarItem> 
       </ns2:SetItemField> 
       <ns2:SetItemField> 
        <ns2:ExtendedFieldURI DistinguishedPropertySetId="Appointment" PropertyId="33303" PropertyType="Integer"/> 
        <ns2:CalendarItem> 
         <ns2:ExtendedProperty> 
          <ns2:ExtendedFieldURI DistinguishedPropertySetId="Appointment" PropertyId="33303" PropertyType="Integer"/> 
          <ns2:Value>1</ns2:Value> 
         </ns2:ExtendedProperty> 
        </ns2:CalendarItem> 
       </ns2:SetItemField> 
      </ns2:Updates> 
     </ns2:ItemChange> 
    </ns1:ItemChanges> 
</ns1:UpdateItem> 

我需要你的幫助來使用EWS API代替進行此調用而不是SOAP調用。

回答

1

我想我明白了:

ExtendedPropertyDefinition definition; 
definition = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Appointment, 33321, MapiPropertyType.Boolean); 
appointment.SetExtendedProperty(definition, true); 
definition = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Appointment, 33303, MapiPropertyType.Integer); 
appointment.SetExtendedProperty(definition, 1); 
appointment.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToNone);