Hi,
I try connection to API crm 2015 online in order to get the service for CRUD message for external application c#.
The connection type is by user of office 365.
When I userd this code I get the error:
Value cannot be null.
Parameter name: identityProvider
Here is the code:
string webservice_user = Common.GetSettings("CrmUserName");
string webservice_password = Common.GetSettings("CrmPassword");
string webservice_uri = Common.GetSettings("CrmUri");
Uri organizationUri = newUri(webservice_uri);
Uri homeRealmUri = null;
ClientCredentials credentials = newClientCredentials();
credentials.UserName.UserName = webservice_user;
credentials.UserName.Password = webservice_password;
OrganizationServiceProxy orgService = newOrganizationServiceProxy(organizationUri, homeRealmUri, credentials, null);
orgService.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(newProxyTypesBehavior());
orgService.EnableProxyTypes();
this.crmService = (IOrganizationService)orgService;
this.UserId = ((WhoAmIResponse)this.crmService.Execute(newWhoAmIRequest())).UserId;//here I get the exception
Also I tried to use by the example project in SDK Toolkit:
SDK\SampleCode\CS\GeneralProgramming\Authentication\AuthenticateWithNoHelp
with Discovery Address:
https://disco.crm4.dynamics.com/XRMServices/2011/Discovery.svc
And I got The same erorr.
Hope for your help,
Thanks,
Rivky