Search code examples
genesysworkspace-desktop-editiongenesys-platform-sdk

Use IConfService to query object by Attributes


How do I query objects by attribute (instead of 'Filter Keys') using the 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);

Solution

  • This worked for me:

    CfgXPathBasedQuery query = new CfgXPathBasedQuery(confService, CfgObjectType.CFGPerson, "CfgPerson[@externalID='the value']");