2013-02-26 106 views
5

मैंने ईडब्ल्यूएस के साथ नियुक्तियों पर विस्तारित गुणों का उपयोग करने का प्रयास किया है, लेकिन मुझे नियुक्तियां फिर से नहीं मिल रही हैं। इन उदाहरणोंएक्सचेंज वेबसाइट सेवा प्रबंधित API - विस्तारित गुणों द्वारा आइटम खोजें

How to Update an Appointment from Exchange Web Service Managed API 2.0 in ASP.NET

जब मैं नियुक्ति प्राप्त करने का प्रयास, मैं पालन किया है::

http://msdn.microsoft.com/en-us/uc14trainingcourse_5l_topic3#_Toc254008129 http://msdn.microsoft.com/en-us/library/exchange/dd633697(v=exchg.80).aspx

लेकिन मैं सेट संपत्ति हिस्सा इस सवाल में दिखाया गया है एक के बराबर है जब मैं लुकअप करता हूं तो कभी भी कोई अपॉइंटमेंट वापस नहीं आती।

 ItemView view = new ItemView(10); 

     // Get the GUID for the property set. 
     Guid MyPropertySetId = new Guid("{" + cGuid + "}"); 

     // Create a definition for the extended property. 
     ExtendedPropertyDefinition extendedPropertyDefinition = 
      new ExtendedPropertyDefinition(MyPropertySetId, "AppointmentID", MapiPropertyType.String); 

     view.PropertySet = 
     new PropertySet(
       BasePropertySet.IdOnly, 
       ItemSchema.Subject, 
       AppointmentSchema.Start, 
       AppointmentSchema.End, extendedPropertyDefinition); 

     SearchFilter filter = new SearchFilter.Exists(extendedPropertyDefinition); 

     FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, filter, 
      view); 

किसी भी मदद की बहुत सराहना की है:

यहाँ देखने के लिए कोड है।

संपादित करें: प्रलेखन तरह से पता चलता जब मैं संपत्ति बनाने का प्रयास करें:

http://msdn.microsoft.com/en-us/library/exchange/dd633654(v=exchg.80).aspx

यह विफल रहता है, क्योंकि इसके एक Guid im संपत्ति के मूल्य के रूप में जोड़ने। : -/

संपादित फिर से: बस आज के लिए सभी नियुक्तियां हो रही है, और नियुक्ति मैं अभी बनाया से संपत्ति हो रही करने की कोशिश की, और यह एक ही कहते हैं के रूप में मैं संग्रहीत, {} के बिना, तो यह होना चाहिए फिल्टर के साथ कुछ। एक बार फिर से

संपादित करें * अगर मैं का उपयोग यह

ExtendedPropertyDefinition extendedProperty = new ExtendedPropertyDefinition(

के साथ क्या करना है somthing है:

new ExtendedPropertyDefinition(
       DefaultExtendedPropertySet.Appointment, 
       "AppointmentID", 
       MapiPropertyType.String); 

यह गुणों के साथ सभी नियुक्तियां पाता है, लेकिन अगर मैं एक विशिष्ट के लिए खोज एक:

Guid MyPropertySetId = new Guid("{" + cGuid + "}"); 

ExtendedPropertyDefinition extendedProperty = 
      new ExtendedPropertyDefinition(
       MyPropertySetId, 
       "AppointmentID", 
       MapiPropertyType.String); 

फिर कुछ भी नहीं मिला है।

उत्तर

20

यहाँ एक samplecode है customid के साथ एक नियुक्ति बनाने और बचाने के बाद यह पता लगाने के लिए कैसे:

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1); 
     service.AutodiscoverUrl("[email protected]"); 

     ExtendedPropertyDefinition def = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, "AppointmenId", MapiPropertyType.String); 

     Guid testid = Guid.NewGuid(); 

     Appointment appointment = new Appointment(service); 
     appointment.Subject = "Test"; 
     appointment.Start = DateTime.Now.AddHours(1); 
     appointment.End = DateTime.Now.AddHours(2); 
     appointment.SetExtendedProperty(def, testid.ToString()); 
     appointment.Save(WellKnownFolderName.Calendar); 

     SearchFilter filter = new SearchFilter.IsEqualTo(def, testid.ToString()); 

     FindItemsResults<Item> fir = service.FindItems(WellKnownFolderName.Calendar, filter, new ItemView(10)); 

आशा है कि यह आप में मदद करता है ...

+0

धन्यवाद, बीमार इसे आजमाएं। – Jacob

+0

मेरे लिए काम करता है! आपका बहुत बहुत धन्यवाद! – Jacob

+0

आपका स्वागत है ... शायद अगली बार जब आप मेरी मदद कर सकें;) क्या आप कृपया "सहायक था" सेट कर सकते हैं;) –

0

आप नियुक्तियों के लिए इनबॉक्स खोजते हैं। वहां आप उन्हें कभी नहीं पाएंगे। इसके बजाय कैलेंडर में खोजने का प्रयास करें।

+0

हाँ, मैं गलत फ़ोल्डर में खोज रहा था , लेकिन यह अभी भी कुछ भी नहीं पाता है: -/ – Jacob

+0

हम्म ... शायद यह आपकी संपत्ति परिभाषा बनाने के तरीके के कारण है। इस कोड को आजमाएं: विस्तारितप्रॉपर्टीडिफिनिशन प्रोपेडेफ़ = नया विस्तारित प्रॉपर्टीडिफिनिशन (माइक्रोसॉफ्ट.एक्सचेंज। वेब सर्विसेज। डेटा।DefaultExtendedPropertySet.PublicStrings, नाम, MapiPropertyType.String); जोड़ने और खोज के लिए । मुझे ग्रिड-वे भी इस्तेमाल करने में कुछ समस्याएं थीं। यह एक आसान है और मेरे कोड में perferct काम करता है। –

0

यहां ग्रिड को विस्तार संपत्ति के रूप में रखने और ग्रिड के आधार पर नियुक्ति प्राप्त करने का एक उदाहरण दिया गया है।

private static readonly PropertyDefinitionBase AppointementIdPropertyDefinition = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, "AppointmentID", MapiPropertyType.String); 
public static PropertySet PropertySet = new PropertySet(BasePropertySet.FirstClassProperties, AppointementIdPropertyDefinition); 


//Setting the property for the appointment 
public static void SetGuidForAppointement(Appointment appointment) 
{ 
    try 
    { 
     appointment.SetExtendedProperty((ExtendedPropertyDefinition)AppointementIdPropertyDefinition, Guid.NewGuid().ToString()); 
     appointment.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToNone); 
    } 
    catch (Exception ex) 
    { 
     // logging the exception 
    } 
} 

//Getting the property for the appointment 
public static string GetGuidForAppointement(Appointment appointment) 
{ 
    var result = ""; 
    try 
    { 
     appointment.Load(PropertySet); 
     foreach (var extendedProperty in appointment.ExtendedProperties) 
     { 
      if (extendedProperty.PropertyDefinition.Name == "AppointmentID") 
      { 
       result = extendedProperty.Value.ToString(); 
      } 
     } 
    } 
    catch (Exception ex) 
    { 
    // logging the exception 
    } 
    return result; 
} 
+0

यह वह कोड है जिसका उपयोग मैं ग्विड को सेट करने के लिए कर रहा हूं। दूसरा भाग एक नियुक्ति से गाइड को पुनर्प्राप्त करता है। मेरी समस्या यह है कि मुझे केवल गिड होने पर विशिष्ट नियुक्ति ढूंढनी होगी। – Jacob

+0

अच्छी तरह से, जब आपको कुछ तिथियों से कुछ तिथियों की नियुक्तियां मिलती हैं, तो आप उन ग्रिड का उपयोग करके यदि आप मिलान करते हैं या नहीं तो आप उनके बीच खोज कर रहे हैं। – BraveHeart