2017-10-03 33 views
6

सीआरएम 2016 ओडाटा/वेब एपीआई का खुलासा करता है, और बॉक्स के बाहर functions और actions है।वेब एपीआई का उपयोग कर संसाधन की उपलब्धता कैसे प्राप्त करें?

संगठन सेवा के साथ

, हम एक अनुरोध like this:

// Create the van required resource object. 
RequiredResource vanReq = new RequiredResource 
{ 
    ResourceId = _vanId, 
    ResourceSpecId = _specId 
}; 

// Create the appointment request. 
AppointmentRequest appointmentReq = new AppointmentRequest 
{ 
    RequiredResources = new RequiredResource[] { vanReq }, 
    Direction = SearchDirection.Backward, 
    Duration = 60, 
    NumberOfResults = 10, 
    ServiceId = _plumberServiceId, 
    // The search window describes the time when the resouce can be scheduled. 
    // It must be set. 
    SearchWindowStart = DateTime.Now.ToUniversalTime(), 
    SearchWindowEnd = DateTime.Now.AddDays(7).ToUniversalTime(), 
    UserTimeZoneCode = 1 
}; 

// Verify whether there are openings available to schedule the appointment using this resource    
SearchRequest search = new SearchRequest 
{ 
    AppointmentRequest = appointmentReq 
}; 
SearchResponse searched = (SearchResponse)_serviceProxy.Execute(search); 

if (searched.SearchResults.Proposals.Length > 0) 
{ 
    Console.WriteLine("Openings are available to schedule the resource."); 
} 

क्या यह संभव है कार्य/कार्रवाई या किसी अन्य OData कार्यक्षमता का उपयोग इस कार्यक्षमता की नकल करने के जारी कर सकते हैं?

मुझे विश्वास है कि अनुरोध कुछ इस तरह होना चाहिए:

crmOrg/api/v8.1/Search([email protected])[email protected]= 

हालांकि, मुझे यकीन है कि शेष अनुरोध सांकेतिक शब्दों में बदलना करने के लिए कैसे नहीं हूँ।

+0

'_serviceProxy.Execute' एक अनुरोध' http' से अधिक (टीसीपी पोर्ट 80) अंत बिंदु करने के लिए भेज देंगे (का उपयोग कर HTTP GET) । आप अपने पीसी पर या तो नेटवर्क स्निफर या डिबगिंग टूल के साथ इस अनुरोध को कैप्चर कर सकते हैं। मैं [फिडलर] (http://www.telerik.com/fiddler) पसंद करता हूं, आप इसे अपने ऐप और एंड पॉइंट के बीच प्रॉक्सी बनने के लिए कॉन्फ़िगर कर सकते हैं और यह यातायात को कैप्चर करेगा। फिर यह केवल उस विशिष्ट अनुरोध के लिए यूआरएल पढ़ने का मामला है जिसे आप नकल करना चाहते हैं। तो सी # में अनुरोध बनाएं और फिडलर में जेनरेट किए गए यूआरएल को कैप्चर करें (* यह एक मुफ्त टूल है, मुझे टेलरिक * के साथ कोई संबद्धता नहीं है)। – Igor

+0

शायद आप fetchxml लिख सकते हैं और इस तरह एक वेब एपीआई कॉल जारी कर सकते हैं: https://community.dynamics.com/crm/b/mscrmcustomization/archive/2016/11/01/use-fetchxml-to-retrieve-data- से-एमएस-सीआरएम-2016-का उपयोग कर वेब-api –

उत्तर

2

पैरामीटर चला जाता है की तरह:

http://yourcrm.org/org/api/data/v8.1/Search([email protected])/[email protected]={SearchWindowStart:%272017-01-01%27,Duration:60,NumberOfResults:10} 

यह धारावाहिक AppointmentRequest वर्ग के यूआरएल इनकोडिंग json है।

{ 
    SearchWindowStart:'2017-01-01', 
    Duration: 60, 
    NumberOfResults:10, 
    etc... 
} 

अधिक यहाँ जानकारी: https://msdn.microsoft.com/en-us/library/microsoft.crm.sdk.messages.appointmentrequest.aspx

Odata संदर्भ: http://odata.github.io/WebApi/04-06-function-parameter-support/

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

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