CAML 'Endswith' equivalent?
-
16-10-2019 - |
Question
I have to pull the data from the custom list by using a CAML query.
I would like to use the "Endswith" option in the CAML query however it seems to be unsupported in sharepoint 2007.
What would be the alternative?
Eg:
Search on Internet
Internet Search
Basic Internet lessons
Urbanization and Internetization
I want to fetch all the items which has a keyword of Internet (except the last one) but not Internetization. Is there any other way to achieve the same without using "Endswith".
Solution
Yes, it's a shame that sharepoint don't have EndsWith. As for answer you can develop a custom web part:
- Use CAML query to reatrive all that contain 'Internet' via
<Contains>
- Results that were provided will only contain those that have 'Intranet' and you can iterate over each item and check if it ends with Internet String.EndsWith .
The worst case if all words contain Internet then implement paging and get them from list in packs that wont create much impact.