Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Can someone tell me how the VB CAML Query would go to select the most recently created List item where 'FullName' field = 'Joe Smooth'.

Using Silverlight 5, SharePoint Client Object Model, VB.Net and a list called 'Staff'.

Thanks.

share|improve this question
What specifically are you stuck on? See guidance on "How to Ask" here: sharepoint.stackexchange.com/questions/how-to-ask – lgaud Dec 15 '12 at 0:11

1 Answer

up vote 0 down vote accepted

You can try either this:

<View>
<RowLimit>1</RowLimit>
<Query>
   <OrderBy>
      <FieldRef Name='Created' Ascending='False' />
   </OrderBy>
   <Where>
      <Eq>
          <FieldRef Name='Name' />
          <Value Type='Text'>Joe Smooth</Value>
      </Eq>
   </Where>
</Query>
</View>

OR

<View> 
<RowLimit>1</RowLimit> 
<Query> 
   <OrderBy> 
      <FieldRef Name='ID' Ascending='False' /> 
   </OrderBy>
   <Where>
      <Eq>
          <FieldRef Name='Name' />
          <Value Type='Text'>Joe Smooth</Value>
      </Eq>
   </Where> 
</Query> 
</View>

This should get you the last inserted item in a List

share|improve this answer
Thanks. Finally got round to trying it. Works fine. – finisterre Mar 18 at 16:23

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.