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
Reference:
http://msdn.microsoft.com/en-us/library/gg327844.aspx
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);
            proxy.EnableProxyTypes();
            Account account = new Account { Name = "Sample Parent Account" };
            var _parentAccountId = proxy.Create(account);

No comments:

Post a Comment