Friday, June 15, 2012

Getting an Error while using Online CRM 2011 Value cannot be null.Parameter name: DeviceCredentials


Introduction:

                    I am using CRM 2011 online and facing the Problem of  Value cannot be null.Parameter name: DeviceCredentials.i used the Following code.

ClientCredentials credential = new ClientCredentials();
credential.Windows.ClientCredential = new NetworkCredential("liveid@hotmail.com", "password", "Kartik");
_serviceProxy = new OrganizationServiceProxy(organizationuri, homeRealmUri, credential, null);
_serviceProxy.EnableProxyTypes();
_service = (IOrganizationService)_serviceProxy;
orgContext = new OrganizationServiceContext(_serviceProxy);

If you facing the above problem then use the following code for that.

  var deviceIDcreds = new ClientCredentials();
  deviceIDcreds.UserName.UserName = "11pqlm4ldg5nqps9b4ivlngbfv";
  deviceIDcreds.UserName.Password = "J-n60IBG7h;Ga`b5##SsDQhP";

  var liveIDCreds = new ClientCredentials();
  liveIDCreds.UserName.UserName = "liveid@hotmail.com";
  liveIDCreds.UserName.Password = "password";

 _serviceProxy = new OrganizationServiceProxy(organizationuri, homeRealmUri, liveIDCreds, deviceIDcreds);
_serviceProxy.EnableProxyTypes();
_service = (IOrganizationService)_serviceProxy;
orgContext = new OrganizationServiceContext(_serviceProxy);

Hope this will help you.

No comments:

Post a Comment