Posts

Showing posts from November, 2012

retrieve,update,assign,create related object records in Microsoft CRM 2011

Hi,
here is a sample of how to obtain records from CRM.

You need prebuild classes from current 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)/organization_name/XRMServices/2011/Organization.svc /out:"\OrganizationCodes.cs " /username:muhammet.atalay /password:ILoveCrm /domain:??? /serviceContextName:...ServiceContext
Do not forget to add OrganizationCodes.cs into your project.

ServiceContext uses as below while retrieving any records via LinQ.
ServiceContext context;
           context = new ServiceContext((IOrganizationService)_serviceProxy);


List contacts = context.ContactSet.Where(c => c.fieldName == criteria).ToList();
you can create a record as follow;
Contact conn = new Contact();
set fields
_serviceProxy.Create(booking);
assign record to a user while creating record
example:
con…

Credentials,tokens sample in Microsoft CRM 2011 from SDK by Late Bind Approach with IFDS deployment

Hi,

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.

IServiceManagement orgServiceManagement =

ServiceConfigurationFactory.CreateManagement( new Uri("http(s)://crm.???.com(:444)/organization_name/XRMServices/2011/Organization.svc"));

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);
Retrieve Token
SecurityTokenResponse orgTokenResponse = null;
if (tokenCredentials != null)
{