How to generate organization service using Microsoft.Xrm.Client dll ?
This is my new post to generate organization service in CRM 2013,2015 and 2016. Simplest method to generate organization service, for this only two line of C# code will be required.
For generation organization service below assemblies are required.
Add below code in .cs file and App config file respectively.
- Microsoft.Xrm.Sdk.dll
- Microsoft.Xrm.Client.dll
- System.configuration
- using Microsoft.Xrm.Client;
- using Microsoft.Xrm.Client.Services;
- using Microsoft.Xrm.Sdk;
- using Microsoft.Xrm.Sdk.Client;
- using Microsoft.Xrm.Sdk.Query;
Add below code in .cs file and App config file respectively.
//.CS File Code
public IOrganizationService getOrganizationService(string key)
{
CrmConnection con = new CrmConnection("CRMOnline");
IOrganizationService service = new OrganizationService(con);
OrganizationServiceContext Context = new OrganizationServiceContext(service);
return service;
}
//App config file code
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version = "v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<connectionStrings>
<add name = "CRMOnline" connectionString="Url=https://Your Organization URL/XRMServices/2011/Organization.svc; Username=xyz; Password=xyzpassword;"/>
</connectionStrings>
</configuration>
Enjoy the great technology Dynamics CRM. Good luck.....!!!!!
Please feel free to put comments for your queries.Thanks.
No comments:
Post a Comment