Credentials,tokens sample in Microsoft CRM 2011 from SDK by Late Bind Approach with IFDS deployment
First of all, Download Microsoft CRM 2011 SDK from Microsoft Web Site.Please ask
google for exact URLs.
do not forget adding Microsoft.xrm.sdk library from SDKs.
Set the credentials.
AuthenticationCredentials authCredentials = new AuthenticationCredentials();
authCredentials.ClientCredentials = new ClientCredentials();
authCredentials.ClientCredentials.UserName.UserName = "muhammet.atalay";
authCredentials.ClientCredentials.UserName.Password = "I Love CRM";
AuthenticationCredentials tokenCredentials = orgServiceManagement.Authenticate(authCredentials);
SecurityTokenResponse orgTokenResponse = null;
if (tokenCredentials != null)
if (tokenCredentials.SecurityTokenResponse != null)
orgTokenResponse = tokenCredentials.SecurityTokenResponse;
if (orgServiceManagement == null)
throw new ArgumentNullException("serverConfiguration.OrganizationServiceManagement");
if (orgServiceManagement != null && orgTokenResponse != null)
_serviceProxy = new OrganizationServiceProxy(
Obtain the organization service proxy for the ActiveDirectory environment.
_serviceProxy = new OrganizationServiceProxy( orgServiceManagement, authCredentials.ClientCredentials);
Early bound needs creating class from Microsoft CRM 2011 deployment.to do this use crmsvcutil.exe which comes from CRM SDK (...SDK\bin\).
Built Class includes both standart Entities and Custom Entities.
Usage : crmsvcutil.exe /url:http(s)://crm.???.com(:444)/company_name/XRMServices/2011/Organization.svc /out:"
you can add OrganizationCodes.cs file to the solution.
ServiceContext uses as below.
context = new
} hopes it is helpfull. Please do not hesitate to ask or leave message .