Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a list where IDs are not unique.

How can I make a CAML Query for this list so I can get all values for a particular ID This is my list:

 ID        Customer     LOB    PeriodOne  PeriodTwo   PeriodThree   
100003        SSD       GH      1521         215            855
100003        SSD       GF      7481         0               25
100003        SSD       TD      5498         325            241
100203        XDC       GH      2521         415            455
100203        XDC       GF      7481         12              55
100203        XDC       TD      588          125            231

Thanks

share|improve this question

2 Answers 2

user7400's answer will query based on the built in SharePoint unique ID field, which this ID field is clearly not. You first need to determine the Internal Name of the ID field in your list - the tools mentioned can help, or, you can look at the query string of the Edit column page from list settings (noting that _ gets encoded as %5F). I think it's most likely ID_0.

The query would then be more like:

<Where>
  <Eq>
     <FieldRef Name='ID_0' />
     <Value Type='Number'>100003</Value>
  </Eq>
</Where>

(Assuming the field is a number and not text; if it is text, set Type="Text" instead)

share|improve this answer

This should give you a result set filtered by your particular ID

<Where>
  <Eq>
     <FieldRef Name='ID' />
     <Value Type='Counter'>100003</Value>
  </Eq>
</Where>

And you want to get yourself the CAML Query Builder (Download the 2007 version) or Designer. It'll save you a ton of time and effort!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.