spquery

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

你。 提交于 2019-12-30 01:54:15
问题 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 within the CAML query. I'm wondering how people have gone about achieving this? 回答1: Another way to do this is to use DataView.ToTable-Method - its first parameter is the one that makes the list

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

百般思念 提交于 2019-12-12 20:33:37
问题 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 = web.GetViewFromUrl("url to my view"); int count = view.ParentList.GetItems(view).Count; My list has 28 items, but the view I'm referencing filters it and shows

Take name and count number of sibling classes in generated ontology using Java

人盡茶涼 提交于 2019-12-12 03:36:14
问题 I first generated the ontology. It was successful. Then, I want to take sibling classes name for each class and count number of sibling classes of each class in the generated ontology.As a example, Main super class- A Two sub classes of A - B , C Three sub classes of B- D, E I tried using following code. I used getSuperClass to get the super class, and then getSubClass to get the subclasses of that. I used arraylist for first take name of each sibling classes. So, in above example output

CAML query that includes folders in result set

本小妞迷上赌 提交于 2019-11-29 01:52:14
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> <Or> <Contains> <FieldRef Name=\"FileRef\" /> <Value Type=\"Text\">foo</Value> </Contains> <Eq> <FieldRef Name=\"FSObjType\" /> <Value Type=\"Lookup\">1</Value> </Eq> </Or> </Where>"; query.ViewFields = " <FieldRef Name=\"CustomField1\" Nullable=\"TRUE\" />

CAML query that includes folders in result set

梦想的初衷 提交于 2019-11-27 16:19:08
问题 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> <Or> <Contains> <FieldRef Name=\"FileRef\" /> <Value Type=\"Text\">foo</Value> </Contains> <Eq> <FieldRef Name=\"FSObjType\" /> <Value Type=\"Lookup\">1<