2012-04-02 15 views
20

मैं मौजूदा अपॉइंटमेंट अपडेट करने की कोशिश कर रहा हूं लेकिन ईडब्ल्यूएस "Set action is invalid for property." फेंक रहा है। मैंने नियुक्ति ऑब्जेक्ट पर सेट किए गए सभी मानों की समीक्षा की, लेकिन मैं इस त्रुटि के वास्तविक कारण को समझने में असमर्थ हूं।ईडब्लूएस: नियुक्ति के आवश्यक एटेंडेंड अपडेट करते समय संपत्ति के लिए एक्शन सेट अमान्य है

यहाँ मेरी कोड स्निपेट है:

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1); 
service.Credentials = new WebCredentials("ews_calendar", PASSWORD, "acme"); 
service.Url = new Uri("https://acme.com/EWS/Exchange.asmx"); 
ImpersonatedUserId impUser = new ImpersonatedUserId(); 
service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "[email protected]"); 

string itemId = ""; 
DateTime PreviousStartDate = new DateTime(2012, 04, 02, 18, 00, 00); 
DateTime PreviousEndDate = new DateTime(2012, 04, 02, 18, 30, 00); 
CalendarView calView = new CalendarView(PreviousStartDate, PreviousEndDate); 
Appointment appointment = new Appointment(service); 
try 
{ 
    calView.PropertySet = new PropertySet(BasePropertySet.IdOnly, AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.IsRecurring, AppointmentSchema.AppointmentType); 
    FindItemsResults<Appointment> findResults = service.FindAppointments(WellKnownFolderName.Calendar, calView); 

    List<Item> items = new List<Item>(); 
    foreach (Appointment appt in findResults.Items) 
    { 
     appt.Load(); 
     items.Add(appt); 
    } 

    if (items.Count > 0) 
    { 
     service.LoadPropertiesForItems(items, PropertySet.FirstClassProperties); 
     appointment = (Appointment) items[0]; 
     appointment.Load(new PropertySet(BasePropertySet.IdOnly, AppointmentSchema.Start, AppointmentSchema.ReminderDueBy, AppointmentSchema.End, AppointmentSchema.StartTimeZone, AppointmentSchema.EndTimeZone, AppointmentSchema.TimeZone)); 
    } 

    appointment.RequiredAttendees.Add("[email protected]"); 

    appointment.Start = new DateTime(2012, 04, 02, 18, 00, 0); 
    appointment.End = new DateTime(2012, 04, 02, 18, 30, 0); 

    // throwing exception here -- Set action is invalid for property. 
    appointment.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToAllAndSaveCopy); 
} 
catch (Exception ex) 
{ 
    // 
} 

[अद्यतन]
दिलचस्प बात यह है कि अगर मैं उपरोक्त कोड में नियुक्ति की RequiredAttendees संपत्ति टिप्पणी, सब कुछ ठीक लग रहा है, लेकिन कोई अधिसूचना ईमेल मौजूदा उपस्थित लोगों के बाहर भेज देते हैं।

[अद्यतन] यह केवल नियुक्तियों जो iCal

का उपयोग कर बनाई गई हैं के लिए हो रहा है

[अद्यतन]

अनुरोध Xml:

POST https://acmemail.com/EWS/Exchange.asmx HTTP/1.1 
Content-Type: text/xml; charset=utf-8 
Accept: text/xml 
User-Agent: ExchangeServicesClient/14.02.0051.000 
Accept-Encoding: gzip,deflate 
Host: acmemail.com 
Cookie: exchangecookie=7d09b9f23afd4604bd17e3aa58aa8417 
Content-Length: 2410 
Expect: 100-continue 
<?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="Exchange2010_SP1" /> 
    <t:ExchangeImpersonation> 
     <t:ConnectingSID> 
     <t:PrincipalName>ews_test_user</t:PrincipalName> 
     </t:ConnectingSID> 
    </t:ExchangeImpersonation> 
    </soap:Header> 
    <soap:Body> 
    <m:UpdateItem ConflictResolution="AlwaysOverwrite" SendMeetingInvitationsOrCancellations="SendOnlyToAll"> 
     <m:ItemChanges> 
     <t:ItemChange> 
      <t:ItemId Id="AAMkADJiMGQ4ZWFkLWE0ODYtNDEyMC1hYWZjLTQ1ZGMyZDIzM2VjNwBGAAAAAAD9u1KcpHbwQZAL98T9qOWmBwCvOn1fMRuFRKKSfl9h8ZjeAAAAoz9XAABZjjBc5hT0S7NHrduyqC0sAAUlvIcSAAA=" ChangeKey="DwAAABYAAABkzlk3d4yMS7uVVX+i+BnJAAAABLU2" /> 
      <t:Updates> 
      <t:SetItemField> 
       <t:FieldURI FieldURI="item:Body" /> 
       <t:CalendarItem> 
       <t:Body BodyType="HTML">TEST 3</t:Body> 
       </t:CalendarItem> 
      </t:SetItemField> 
      <t:SetItemField> 
       <t:FieldURI FieldURI="calendar:RequiredAttendees" /> 
       <t:CalendarItem> 
       <t:RequiredAttendees> 
        <t:Attendee> 
        <t:Mailbox> 
         <t:Name>Tin.Tin</t:Name> 
         <t:EmailAddress>[email protected]</t:EmailAddress> 
         <t:RoutingType>SMTP</t:RoutingType> 
         <t:MailboxType>Mailbox</t:MailboxType> 
        </t:Mailbox> 
        </t:Attendee> 
        <t:Attendee> 
        <t:Mailbox> 
         <t:Name>Tin.Tin</t:Name> 
         <t:EmailAddress>[email protected]</t:EmailAddress> 
         <t:RoutingType>SMTP</t:RoutingType> 
         <t:MailboxType>OneOff</t:MailboxType> 
        </t:Mailbox> 
        </t:Attendee> 
       </t:RequiredAttendees> 
       </t:CalendarItem> 
      </t:SetItemField> 
      </t:Updates> 
     </t:ItemChange> 
     </m:ItemChanges> 
    </m:UpdateItem> 
    </soap:Body> 
</soap:Envelope> 

प्रतिक्रिया XML:

<?xml version="1.0" encoding="utf-8"?> 
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
    <s:Header> 
     <h:ServerVersionInfo MajorVersion="14" MinorVersion="1" MajorBuildNumber="355" MinorBuildNumber="2" Version="Exchange2010_SP1" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/> 
    </s:Header> 
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
     <m:UpdateItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> 
      <m:ResponseMessages> 
       <m:UpdateItemResponseMessage ResponseClass="Error"> 
        <m:MessageText>Set action is invalid for property.</m:MessageText> 
        <m:ResponseCode>ErrorInvalidPropertySet</m:ResponseCode> 
        <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey> 
        <m:MessageXml> 
         <t:FieldURI FieldURI="calendar:RequiredAttendees"/></m:MessageXml> 
        <m:Items/> 
       </m:UpdateItemResponseMessage> 
      </m:ResponseMessages> 
     </m:UpdateItemResponse> 
    </s:Body> 
</s:Envelope> 
+1

फिरोज़, क्या आपको कोई समाधान मिला है? मेरे पास एक ही समस्या है और चिह्नित सिल्वरनिंज का जवाब मदद नहीं करता है। – MikhailSP

+0

पुरानी पोस्ट लेकिन शायद अभी भी कोई एलएफ उत्तर: केवल मीटिंग का आयोजक इसके मूल्यों को अपडेट कर सकता है, इसलिए यदि संभव हो तो आपको आयोजक को प्रतिरूपण करने की आवश्यकता है। – YvesR

उत्तर

7

आप अगर आप इसे बदलना चाहते हैं (RequiredAttendees.Add नियुक्ति स्कीमा संपत्ति स्थापित कर रही है) इच्छा अपने PropertySet को AppointmentSchema.RequiredAttendees जोड़ने की जरूरत है। आप उस प्रॉपर्टी को संशोधित नहीं कर सकते जो आपके PropertySet में शामिल नहीं है।

appointment.Load(new PropertySet(BasePropertySet.IdOnly, AppointmentSchema.Start, AppointmentSchema.ReminderDueBy, AppointmentSchema.End, AppointmentSchema.StartTimeZone, AppointmentSchema.EndTimeZone, AppointmentSchema.TimeZone, AppointmentSchema.RequiredAttendees)); 

आपकी प्रतिक्रिया एक्सएमएल समीक्षा करने के बाद - यह इस मुद्दे AppointmentState से संबंधित है लगता है। संदर्भ के लिए this MSDN post देखें। प्रतिक्रिया एक्सएमएल आपको वह फ़ील्ड बताता है जो अद्यतन करने में विफल रहा है (calendar:RequiredAttendees)।

+0

मैंने आपके प्रॉपर्टीसेट में अपॉइंटमेंटस्केमा.रूक्टेड एटेंडिडीज को बताया जैसा कि आपने सुझाव दिया था, लेकिन फिर भी वही त्रुटि। क्या यह जानना संभव है कि कौन सी संपत्ति इस मुद्दे का कारण बन रही है? "संपत्ति के लिए कार्रवाई सेट अमान्य है" बहुत सामान्य त्रुटि संदेश है। –

+0

मैं आपकी सहायता की समीक्षा करता हूं SliverNinja। मैं ईडब्ल्यूएस एपीआई के साथ थोड़ा नया हूँ। क्या आप इस मुद्दे को हल करने के लिए मेरे कोड में बदलाव करने में मेरी मदद कर सकते हैं। –

+0

आप सही हैं। नियुक्ति चरण 3 है (जिसका अर्थ यह है कि इसे प्रतिभागी के रूप में विचार करना)। नियुक्ति मालिकों को बैठक मालिकों के लिए 1 होना चाहिए। मुझे यकीन नहीं है कि अपॉइंटमेंटस्टेट संपत्ति कैसे सेट करें क्योंकि यह नियुक्ति ऑब्जेक्ट के लिए केवल पढ़ने योग्य है। मुझे लगता है कि मैं समाधान के करीब कहीं हूँ। –

 संबंधित मुद्दे

  • कोई संबंधित समस्या नहीं^_^