0
votes

please help with this below code to change to oauth

 // Create Server Configuration 
 ServerConnection.Configuration config = new ServerConnection.Configuration();
 config.ServerAddress = serverAddress;
 config.DiscoveryUri = new Uri(String.Format("xxx", config.ServerAddress));
 config.OrganizationName = organizationName;
 config.OrganizationUri = new Uri(String.Format("xxx", config.ServerAddress));
 config.Credentials = credentials;

 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
 crmServiceClient = new CrmServiceClient('xxx', credentials);
 //dynamicsServiceProxy = ServerConnection.GetOrganizationProxy(config);        
 //dynamicsServiceProxy.EnableProxyTypes();        
 crmServiceClient.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new 
 ProxyTypesBehavior(Assembly.GetExecutingAssembly()));

Any one please help me what changes i need to do?

I have Read this article but how to replace IOrganizationService in code?