How to get unique values from a sharepoint list column?
I have a column of date datatype. The user may type in any date开发者_如何学C. I need to check in the code for unique year values in the column. Is there any C3 direct syantax is tere or I need to use CMAL query... Thanks in advance.
You have no other options, but to use CAML Query. To achieve better performance, do the following:
- Use CAML Query and specify RowLimit = 1 for better performance.
- If you must have unique year value,
then that list data can be no way so
huge that it would cause major
performance implications unless you
have other list data of different
content types in list. If you do,
don't forget to specify what content
type are you querying in your query
like
<FieldRef Name="ContentTypeId"/><BeginsWith>0x...</BeginsWith>
. - Oh, and in queries ViewFields specify only that field you're interested in.
Just make as specific query as you can.
精彩评论