我们正在尝试使用 Microsoft.CrmSdk.XrmTooling.CoreAssembly 和参数 ClientId 和 ClientSecret,通过 C# 代码(Azure 托管的 WebAPI)连接 Dynamics 365 统一接口(interface)实例。但我们得到了低于错误。
"Unable to connect to CRM: Method not found: 'System.String Microsoft.Xrm.Sdk.Organization.OrganizationDetail.get_EnvironmentId()'. Method not found: 'System.String Microsoft.Xrm.Sdk.Organization.OrganizationDetail.get_EnvironmentId()'.Unable to Login to Dynamics CRM Unable to Login to Dynamics CRMOrganizationWebProxyClient is null OrganizationWebProxyClient is null"
请注意,我们在 Framework 4.6.2 中使用了最新的 NuGet 版本“Microsoft.CrmSdk.XrmTooling.CoreAssembly”。
下面是我们编写的代码
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
IOrganizationService organizationService = null;
string organizationURI = "https://OrgName.api.crm.dynamics.com/XRMServices/2011/Organization.svc";
string clientId = "Clientid";
string clientSecret = "ClientSecret";
var connection = new CrmServiceClient($@"AuthType=ClientSecret;url={organizationURI};ClientId={clientId};ClientSecret={clientSecret}");
if (connection.IsReady)
{
organizationService = connection.OrganizationWebProxyClient != null ? connection.OrganizationWebProxyClient : (IOrganizationService)connection.OrganizationServiceProxy;
}
最佳答案
我遇到了同样的问题,在我删除了每个 .dll 文件并重新安装它们后,它起作用了。所以,我猜你的 .dll 版本有问题。
关于c# - 无法在 C# 中使用 "Microsoft.CrmSdk.XrmTooling.CoreAssembly"连接 Dynamics 365 统一接口(interface),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64257911/