开发者

How to get unique values from a sharepoint list column?

开发者 https://www.devze.com 2022-12-27 11:29 出处:网络
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

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:

  1. Use CAML Query and specify RowLimit = 1 for better performance.
  2. 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>.
  3. Oh, and in queries ViewFields specify only that field you're interested in.

Just make as specific query as you can.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号