如何设置'只读日历约会属性(与会议相关)?

时间:2015-07-28 13:40:48

标签: soap exchangewebservices

我在同步工具中重新创建日历会议事件(使用CreateItem),基本上为会议保留了一些属性并将其写回。

但是,有些属性是只读的,我认为无法保留其状态:

  • IsMeeting
  • IsCancelled
  • MeetingRequestWasSent
  • IsOnlineMeeting

其中一些布尔值存储在属性AppointmentState中,但也是只读的:

Name      Bit      Description

None      0x0000   No flags have been set. This is only used for an appointment that does not include attendees.
Meeting   0x0001   This appointment is a meeting.
Received  0x0002   This appointment has been received.
Canceled  0x0004   This appointment has been canceled.

如果我设置了其他会议属性,可能会自动设置IsMeeting,例如OptionalAttendeesRequiredAttendees?这将有助于四个中的一个, if 我知道哪些属性会触发IsMeeting的设置。

(是的,这是Meeting request properties not settable in EWS SOAP calls?)的后续行动。

1 个答案:

答案 0 :(得分:2)

您应该能够使用MAPI扩展属性: 任命状态是

Named Prop Name: id: 0x8217=33303 = PidLidAppointmentStateFlags, dispidApptStateFlags
Named Prop Guid: {00062002-0000-0000-C000-000000000046} = PSETID_Appointment

所以应该是类似

的SOAP
<t:ExtendedProperty>
  <t:ExtendedFieldURI DistinguishedPropertySetId="Appointment" PropertyId="33303" PropertyType="Integer" />
   <t:Value>1</t:Value>
</t:ExtendedProperty>

(我使用托管API,并从跟踪日志中获取该XML,希望这是您可以使用的)

[由OP编辑]这是完成工作的完整调用:

<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types"
  xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
<soapenv:Header>
  <typ:RequestServerVersion Version="Exchange2007_SP1"/>
  <typ:MailboxCulture>en-US</typ:MailboxCulture>
  <typ:TimeZoneContext>
     <typ:TimeZoneDefinition Id="W. Europe Standard Time"/>
  </typ:TimeZoneContext>
</soapenv:Header>
<soapenv:Body>
<mes:UpdateItem ConflictResolution="AutoResolve" SendMeetingInvitationsOrCancellations="SendOnlyToChanged">
   <mes:ItemChanges>
      <typ:ItemChange>
         <typ:ItemId <t:ItemId Id="AAMkA[snip]xAAA=" ChangeKey="Dw[snip]Mar"/>
         <typ:Updates>
            <typ:SetItemField>
               <typ:ExtendedFieldURI DistinguishedPropertySetId="Appointment" PropertyId="33303" PropertyType="Integer"/>
               <typ:CalendarItem>
                  <typ:ExtendedProperty>
                     <typ:ExtendedFieldURI DistinguishedPropertySetId="Appointment" PropertyId="33303" PropertyType="Integer"/>
                     <typ:Value>5</typ:Value>
                  </typ:ExtendedProperty>
               </typ:CalendarItem>
            </typ:SetItemField>
         </typ:Updates>
      </typ:ItemChange>
   </mes:ItemChanges>
</mes:UpdateItem>
</soapenv:Body>
</soapenv:Envelope>

奇怪的是,结果显示“成功”,但报告了(一)冲突。我不知道哪一个:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
      <h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="225" MinorBuildNumber="19" Version="V2_48" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
   </s:Header>
   <s:Body>
      <m:UpdateItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
         <m:ResponseMessages>
            <m:UpdateItemResponseMessage ResponseClass="Success">
               <m:ResponseCode>NoError</m:ResponseCode>
               <m:Items>
                  <t:CalendarItem>
                     <t:ItemId Id="AAMk[snip]xAAA=" ChangeKey="DwA[snip]aMat"/>
                  </t:CalendarItem>
               </m:Items>
               <m:ConflictResults>
                  <t:Count>1</t:Count>
               </m:ConflictResults>
            </m:UpdateItemResponseMessage>
         </m:ResponseMessages>
      </m:UpdateItemResponse>
   </s:Body>
</s:Envelope>