【发布时间】:2020-04-29 08:57:46
【问题描述】:
CRM 本地环境中有多个组织。我已将 DiscoveryService URL 和组织名称存储在配置文件中。
我想使用配置文件中可用的组织名称获取特定组织的组织实例,而不是加载所有组织。
类似的东西,
select organizations from Organizations where orgName = 'XYZ'
目前,我正在使用以下代码,检索实例需要 3 秒以上。
private OrganizationDetail DiscoverOrganization(Uri discoveryUri, string organizationName, ClientCredentials lclClientCredentials)
{
DiscoveryServiceProxy serviceProxy;
using (serviceProxy = new DiscoveryServiceProxy(discoveryUri, null, lclClientCredentials, null))
{
IDiscoveryService service = serviceProxy;
var orgsRequest = new RetrieveOrganizationsRequest() { AccessType = EndpointAccessType.Default, Release = OrganizationRelease.Current };
var organizations = (RetrieveOrganizationsResponse)service.Execute(orgsRequest);
return organizations.Details.FirstOrDefault(x => x.UniqueName.ToLower() == organizationName.ToLower());
}
}
【问题讨论】:
-
你试过了吗?
标签: dynamics-crm crm organization