Hi ,
I am searching for a contact in UCS where FirstName, LastName, EmailAddress Like "Patty" and ComplexSearchCriteria is throwing an error, "More elements required for complex constraint". I added the Criterias and Prefix properties, but it still giving the error. Is anyone know what the problem is?
Here is the Code:
Public Sub requestToSearchAContact(ByVal str As String)
_log.WriteDebug("Multimedia: Search a Contact")
Try
Dim request As New RequestGetContacts
request.TenantId = _tenantID
request.SearchCriteria = New SearchCriteriaCollection()
Dim sscF As SimpleSearchCriteria = New SimpleSearchCriteria()
sscF.AttrName = ContactSearchCriteriaConstants.FirstName
sscF.AttrValue = str
sscF.Operator = New NullableOperators(Operators.Like)
Dim sscL As SimpleSearchCriteria = New SimpleSearchCriteria()
sscL.AttrName = ContactSearchCriteriaConstants.LastName
sscL.AttrValue = str
sscL.Operator = New NullableOperators(Operators.Like)
Dim sscE As SimpleSearchCriteria = New SimpleSearchCriteria()
sscE.AttrName = ContactSearchCriteriaConstants.EmailAddress
sscE.AttrValue = str
sscE.Operator = New NullableOperators(Operators.Like)
Dim cplx As ComplexSearchCriteria = New ComplexSearchCriteria()
cplx.Prefix = New NullablePrefixes(Prefixes.Or)
cplx.Criterias = New SearchCriteriaCollection()
cplx.Criterias.Add(sscF)
cplx.Criterias.Add(sscL)
cplx.Criterias.Add(sscE)
request.SearchCriteria.Add(cplx)
request.SortCriteria = New SortCriteriaCollection()
Dim srt As SortCriteria = New SortCriteria
srt.AttrName = ContactSortCriteriaConstants.LastName
srt.SortIndex = 0
srt.SortOperator = SortMode.Ascending
request.SortCriteria.Add(srt)
request.Restricted = False
_targetForUcsRequests.BeginInvoke(New UcsServerAndRequest(_ucs, request), _callbackForUcsRequests, Nothing)
Catch ex As Exception
If _log.Enabled Then _log.WriteTrace("Multimedia:requestToSearchAContac t.")
If _log.Enabled Then _log.WriteTrace("Multimedia: " + ex.ToString)
End Try
End Sub