CRM Dynamics - Get service uri from FaultException<Organi
本文关键字:FaultException lt Organi from uri Dynamics Get service CRM | 更新日期: 2023-09-27 18:03:10
我想记录一条错误消息,其中包含如下所示的catch块中CRM连接的服务uri。我怎么去那儿?
protected static SystemUser ReallyCreateSystemUser(IOrganizationService service, SystemUser user) {
try {
var systemUserId = service.Create(user);
} catch (FaultException<OrganizationServiceFault> ex) {
// I want to trace the service uri of the crm connection here
}
}
ServiceUri
信息包含在CrmConnection类中
如果您正在构建类似控制台的应用程序,您可以从CrmConnection
创建IOrganizationService
,例如:
var connection = new CrmConnection("CRMOnline");
var service = new OrganizationService(connection);
所以我建议在该点检索ServiceUri
信息,例如:
var serviceUri = connection.ServiceUri;