spquery

What is the best way to retrieve distinct / unique values using SPQuery?

I have a list that looks like: Movie Year ----- ---- Fight Club 1999 The Matrix 1999 Pulp Fiction 1994 Using CAML and the SPQuery object I need to get a distinct list of items from the Year column which will populate a drop down control. Searching around there doesn't appear to be a way of doing this withi...

How do I get recurring SharePoint Calendar List Items

Im running this query on the same server as the web application, so SPQuery.ExpandRecurrence should work. However, with the following I only get 3 items in the returned list collection vs. the 3 items and the re-occurrences, all of which fall within the current month. I did verify with Stramit Caml Viewer that the query works, and retu...

CAML query that includes folders in result set

I'm trying to write a CAML query that executes against a specific SPList, scoped to a specific folder, recursive from that point, and returns all ListItems (which meet a criteria) and Folders. Here's the code for the query which seems like it should work (formatted for readability): SPQuery query = new SPQuery(); query.Query = " <Where...

Get items from sharepoint list by Title field with ignore care using Caml or SPQuery

I want to get data from SharePoint List using CAML and filtered by Title with ignore case like <Query> <Where> <Eq> <FieldRef Name='Title' /> <Value Type='Text'>Car</Value> </Eq> </Where> </Query> But with ignore case so if i have an item with title: car the caml should return it how can I do this? ...

SharePoint's List.GetItems(view) returns ALL items instead of filtered view items

I'm trying to get a count of items in a list, based on a view. Every method I've tried so far only returns the grand total of the list. I've tried just about every method I've run across while searching, and everything ends up with the same results. Here's one of the methods I've tried: SPWeb web = SPContext.Current.Web; SPView view = ...

Enumerate all folders in a SharePoint list recursively

Is it possible to get a list of all folders in a SharePoint document library, using SPQuery? Something you could get in file system, if you opened Windows command prompt and ran dir /b /A:D /S The problem is, if you create a simple SPQuery and set the viewAttributes to Scope='RecursiveAll', the result set contains items, but not th...

Can I retrieve additional fields for a SPListItem from SPQuery which had ViewFields set?

I am retrieving SPListItems from SPList with a SPQuery that has ViewFields set. I am using ViewFields to improve performance. However, for some items, I need additional data. I know I can just retrieve the single item again with a new query. However, I am wondering, is there a more efficient way that would allow me to just pull the addit...

How can I write a SPQuery to filter items based on a LinkFieldValue?

I need to select a single value from a SharePoint list based on a field value. The type of the field is LinkFieldValue. How should I write the CAML query? When I select the items with an empty query, I receive all the items in the list as expected. When I add constraints to the query, it returns an empty result. I have tried constructi...