Sunday, March 6, 2016

The caller was not authenticated by the service MSCRM 2015 C#

ClientCredentials creds = new ClientCredentials();
                // Credentials
                creds.UserName.UserName = userName;
                creds.UserName.Password = password;
                OrganizationServiceProxy service = new OrganizationServiceProxy(new Uri(orgURL), null, creds, null);
                service.Timeout = new TimeSpan(0, 5, 0);
                //service.EnableProxyTypes();
                return (IOrganizationService)service;

then changed to the below and it works fine... :)

ClientCredentials creds = new ClientCredentials();
                // Credentials
                creds.Windows.ClientCredential = new System.Net.NetworkCredential(userName, password, domain);
                OrganizationServiceProxy service = new OrganizationServiceProxy(new Uri(orgURL), null, creds, null);
                service.Timeout = new TimeSpan(0, 5, 0);
                //service.EnableProxyTypes();
                return (IOrganizationService)service;





1 comment:

  1. Hi,Thanks for sharing this useful piece of content with us...Keep updating regularly..looking forward to see your further posts. CRM Services
    Digital Payment Platform
    PHP Services
    Ecommerce Service Provider

    ReplyDelete