RE: Microsoft.IdentityModel.Clients.ActiveDirectory.dll NULL when insert rows in Dynamics 365 from windows service c#
Hi, sorry for the delay.
This code is for connect to CRM Instance:
var connectionString = @"AuthType=ClientSecret;Url=xxxxxxx.crm.dynamics.com/;ClientID=" + "xxxxxxxxx" + ";ClientSecret=" + "xxxxxxxxxxx";
CrmServiceClient conn = new CrmServiceClient(connectionString);
return new OrganizationServiceManager(conn);
Later, i use this OrganizationServiceManager to execute multiple insert in CRM (_servicio is the return from the connection)
var options = new OrganizationServiceProxyOptions()
{
Timeout = new TimeSpan(0, 40, 0)
};
IDictionary<string, ExecuteMultipleResponse> _resultadoPeticion = _servicio.ParallelProxy.Execute<ExecuteMultipleRequest, ExecuteMultipleResponse>(_colleccionBloques, options);
_callback(_resultadoPeticion, _colleccionBloques, _log, nombreTabla, nombreCampoEstado, nombreAtributoLlave, nombreColumnaLlave, GuardarSQL);
IImportant: This code works well in a console app, but inside a windows service generate the error described.