使用IConfService按属性查询对象

时间:2017-07-12 20:34:13

标签: genesys workspace-desktop-edition genesys-platform-sdk

如何使用Genesys Platform SDK按属性(而不是'过滤键')查询对象?

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);

2 个答案:

答案 0 :(得分:1)

这对我有用:

SafeHandleZeroOrMinusOneIsInvalid

答案 1 :(得分:0)

在下面使用:

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进行过滤。