使用 IConfService 按属性查询对象
Use IConfService to query object by Attributes
如何使用 Genesys Platform SDK 按属性(而不是 'Filter Keys')查询对象?
Endpoint endpoint = new Endpoint("DEV", "the host", 12020);
endpoint.ServicePrincipalName = "the host/the principle";
_confServerProtocol = new ConfServerProtocol(endpoint);
_confServerProtocol.ClientApplicationType = (int)CfgAppType.CFGSCE;
_confServerProtocol.ClientName = "default";
_confServerProtocol.UserName = "the userid";
_confServerProtocol.Open();
IConfService confService = ConfServiceFactory.CreateConfService(_confServerProtocol);
CfgPersonQuery query = new CfgPersonQuery();
// Need to filter based on an Attribute Value (specifically externalID)
var foo = confService.RetrieveMultipleObjects<CfgPerson>(query);
这对我有用:
CfgXPathBasedQuery query = new CfgXPathBasedQuery(confService, CfgObjectType.CFGPerson, "CfgPerson[@externalID='the value']");
使用如下:
Uri uri = new Uri("tcp://Host:Port");
Endpoint endpoint = new Endpoint(Guid.NewGuid().ToString(), uri);
ConfServerProtocol confProtocol = new ConfServerProtocol(endpoint);
confProtocol.ClientApplicationType = (int)CfgAppType.CFGSCE;
confProtocol.ClientName = "default";
confProtocol.UserName = "xxxxxx";
confProtocol.UserPassword = "xxxxxx";
//Channel Open
confProtocol.Open();
IConfService confService = ConfServiceFactory.CreateConfService(confProtocol);
CfgPersonQuery query = new CfgPersonQuery();
query.UserName = "AgentID";
CfgPerson person = confService.RetrieveObjects<CfgPerson>(query);
string ExtID = person.ExternalId;
注意:这种方式无法通过ExternalId进行过滤
如何使用 Genesys Platform SDK 按属性(而不是 'Filter Keys')查询对象?
Endpoint endpoint = new Endpoint("DEV", "the host", 12020);
endpoint.ServicePrincipalName = "the host/the principle";
_confServerProtocol = new ConfServerProtocol(endpoint);
_confServerProtocol.ClientApplicationType = (int)CfgAppType.CFGSCE;
_confServerProtocol.ClientName = "default";
_confServerProtocol.UserName = "the userid";
_confServerProtocol.Open();
IConfService confService = ConfServiceFactory.CreateConfService(_confServerProtocol);
CfgPersonQuery query = new CfgPersonQuery();
// Need to filter based on an Attribute Value (specifically externalID)
var foo = confService.RetrieveMultipleObjects<CfgPerson>(query);
这对我有用:
CfgXPathBasedQuery query = new CfgXPathBasedQuery(confService, CfgObjectType.CFGPerson, "CfgPerson[@externalID='the value']");
使用如下:
Uri uri = new Uri("tcp://Host:Port");
Endpoint endpoint = new Endpoint(Guid.NewGuid().ToString(), uri);
ConfServerProtocol confProtocol = new ConfServerProtocol(endpoint);
confProtocol.ClientApplicationType = (int)CfgAppType.CFGSCE;
confProtocol.ClientName = "default";
confProtocol.UserName = "xxxxxx";
confProtocol.UserPassword = "xxxxxx";
//Channel Open
confProtocol.Open();
IConfService confService = ConfServiceFactory.CreateConfService(confProtocol);
CfgPersonQuery query = new CfgPersonQuery();
query.UserName = "AgentID";
CfgPerson person = confService.RetrieveObjects<CfgPerson>(query);
string ExtID = person.ExternalId;
注意:这种方式无法通过ExternalId进行过滤