Friday, September 13, 2013

The minimum steps to try out Microsoft CRM early binding

1. Generate CRM entity by CrmSDvcUtil.exe tool in folder of crm\sdk\bin
CrmSvcUtil.exe /url:http://ServerName/OrganizationName/XRMServices/2011/Organization.svc /out:CSFileName.cs /username:usernamewithDomain /password:password /namespace:namespace /serviceContextName:contexName

2. Add following code in console app (Copy generate cs file into project and add it into)
            var _credentials = new ClientCredentials();
            _credentials.Windows.ClientCredential = (NetworkCredential)CredentialCache.DefaultCredentials;
            string CRM_SDK_URL = "http://ServerName/OrganizationName/XRMServices/2011/Organization.svc";
            OrganizationServiceProxy proxy = new OrganizationServiceProxy(new Uri(CRM_SDK_URL), null, _credentials, null);
            Account account = new Account { Name = "Sample Parent Account" };
            var _parentAccountId = proxy.Create(account);

No comments:

Post a Comment