
Hi
I am new to WCF implementation.
I have following code which was working fine, but somehow it has stopped working and giving following error:
Unable to Login to Dynamics CRM OrganizationWebProxyClient is null OrganizationServiceProxy is null
Following is the code snippet
private static IOrganizationService GetService(string url, string uname, string pwd)
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
string servconn = (!string.IsNullOrWhiteSpace(url) && !string.IsNullOrWhiteSpace(uname) && !string.IsNullOrWhiteSpace(pwd)) ? "AuthType=Office365;Username=" + uname + ";Password=" + pwd + ";Url=" + url
: Convert.ToString(ConfigurationManager.ConnectionStrings["CRMConString"].ConnectionString);
CrmServiceClient c = new CrmServiceClient(servconn);
IOrganizationService Service = c.OrganizationWebProxyClient ?? (IOrganizationService)c.OrganizationServiceProxy;
return Service;
}
Kindly help me with this.
Hi,
Please refer to the following documentation:
It states that:
Office365 AuthType is deprecated and we recommend to use OAuth as the preferred authentication type.
This section also provides a sample code for using OAuth authentication.
Details about the Deprecation:
To allow for transition of customers and partner applications: