For all the latest and coolest features that we have illustrated in this blog series, they are only available in CRM Online 2015 Update 1 release. If you try to send any of the new SOAP messages to a server that has a lower version (including CRM 2015 on-premises), your code will break, as the feature is not supported. So we need a way to detect whether the server is capable of dealing with the new features.
The good news is, this is actually a relatively simple task, as CRM SDK has offered a RetrieveVersionRequest message which allows you to sniffer the server version. Let me show you how this can be done.
using (var service = new OrganizationService(crmConnection)) { var request = new RetrieveVersionRequest(); var response = (RetrieveVersionResponse)service.Execute(request); var version = new Version(response.Version); if (version >= new Version("7.1")) { // Do the new way } else { // Do the old way } }
The idea is, you use the RetrieveVersionRequest message to get the CRM server version, and check whether it is greater than 7.1 (which corresponds to CRM Online 2015 Update 1 release). If yes, you do things in the new way using the new SDK capabilities. Otherwise, you would use the old approach (if available).
This concludes my blog post series: New SDK capabilities - CRM Online 2015 Update 1 release. Hope this has helped.
Cheers,
Daniel Cai | KingswaySoft
Read the full New SDK Capabilities Blog Series:
- Part 1 - Alternate Keys
- Part 2 - Upsert
- Part 3 - No more special messages for special fields
- Part 4 - Plugin Trace Logging
- Part 5 - Entity Change Tracking
- Part 6 - Transactional Batching
- Part 7 - Optimistic Concurrency
- Part 8 - New Query Operators
- Part 9 - Detect SDK Capabilities by Checking CRM Server Version