SPQuery represents a query in a list view.

learn more… | top users | synonyms

2
votes
1answer
2k views

ProjectedFields working in SPQuery but not in the View

I've three lists: Competitions, Works and WorksVotes, linked to each other through Lookup fields. WorksVotes list has Lookup field to Works list, and Works list has Lookup field to Competitions list. ...
0
votes
0answers
39 views

Show all events ([today]) in Listview including “Recurring events”

I need a calender, which I can filter for events that take place [today]. The recurring events are not showing, when filtering for [today] and StartDate. Is it possible to have such a view with CAML ...
0
votes
1answer
46 views

GetItems Ignores ViewFields in Query

I have created the following method to fetch list items from a list. The method does return the right items, but no matter what I provide in the viewFields parameter, it always returns all fields. ...
1
vote
2answers
104 views

SP - CAML Query with three AND operators

I have a CAML Query with range between two dates and one text from DropDownList. Where I'm wrong in this query: myquery.Query = " <Where> <And> <FieldRef Name='...
0
votes
0answers
27 views

Restrict SharePoint Results

We want to restrict the shown subsites in our result search webpart to only the first subsite and not all subsites in the subsite. I try to explain it to you with a example... We have a Site ...
2
votes
0answers
59 views

SPQuery returns wrong values

The Setup I have a list with 2 extra columns. Target Audience: Choice (Relevant/Everyone) Tags: Managed Metadata field (multiple) When I choose in the "Target Audience" field "Everyone", this ...
2
votes
2answers
70 views

Query to a list doesn't work

I want to get the number of comments from the list "Comments" of a blog site. To do that, I have a query with this code: using (SPWeb oWebsite = oSiteCollection.OpenWeb(new Guid(WebId))) ...
0
votes
1answer
33 views

How get items in two subfolders?

I need get items from two different folders in a list on Sharepoint 2010, I already have the following code: SPList List = web.Lists["MyList"]; _titleFolderDispositivos = "firstfolder"; // ...
0
votes
0answers
35 views

List View Threshold error

I have a unique problem. I'm getting LVT error when running a script that displays every users' files that they have checked out across all libraries in a web scope in production. Here are a few ...
2
votes
2answers
7k views

Using SPQuery with SPList.GetItems(SPView)

I have a web-part which displays a variety of items in a spgridview based on a SPView. Additionally, I have implemented a search module which when a keyword is entered should get all items that has a ...
5
votes
2answers
15k views

How do I query a list using CAML and SPQuery?

I have a SPList but I don't need to go through everything in that list. I need to establish a CAML query so I can limit the list items. Then, go thru each item from the query result and do something. ...
1
vote
2answers
1k views

DateRangesOverlap always returns all results

I have a problem with SPQuery and DataRangesOverlap. In my calendar there are three events that don't happen today. In SPQuery.query I want to exclude these events. Unfortunately all events are ...
1
vote
1answer
297 views

what SPQuery.RowLimit return

In the below code what query.RowLimit = 3 will return. i guess if i got 10 values in query variable, then query.RowLimit = 3 will return first 3 values, Am i correct? or it will return somthing else? ...
0
votes
2answers
168 views

How to query large list and retrieve one field of all items?

Image a list with i.e. 20.000 list items. All items have the field ContainerId (indexed). I now want to retrieve all ContainerIds to do other stuff with those. SPQuery is limited to a maximum of 2000 ...
0
votes
1answer
123 views

GetListItemChangesSinceToken Folder Query option

I would like to get the list of folders and list items one level at a time, instead of querying all items under a SharePoint list. I plowed through SharePoint documentations and Stackoverflow and ...
0
votes
1answer
277 views

_ModerationStatus on list items is always draft from SPQuery

I am querying for list items in a timer job. The list has moderation enabled. It has various list items that have different approval status (e.g. scheduled, approved etc.). However the query always ...
0
votes
1answer
65 views

SharePoint 2010 Workflow Tasks SPQuery

I have a list item that gets triggered daily to send a workflow task. I created a web part to search based on different column values of the list item and the tasks. Currently: It goes through the ...
9
votes
2answers
16k views

CAML query limitation of values in IN operator

I have less than 5000 items in my library. I want to get 530 items by ids. So I am using following query. <Where> <In> <FieldRef Name="ID" /> <Values> <...
0
votes
1answer
686 views

Which of these is the best way to get a list item collection?

Performance-wise which of these methods is the best way to get a list item collection, and why? SPList list = web.getlist("listurl"); SPListItemCollection items = list.getItems(query); foreach(...
0
votes
1answer
489 views

How to get Single Record from Sharepoint Library when Items in library are more than List Threshold value?

I am trying to get single record from Large Sharepoint library using SPQuery/CamlQuery. The List View Threshold value and List View Threshold for auditors and administrators value is set to 2000. When ...
0
votes
1answer
359 views

How Does Calender List DateRangesOverlap <Today/>,<Month/>,<Year/> and <Week/> exactly work?

I have a SharePoint calendar list which has some recurring events i wanted a report of about last two years. Following is the code that i have written SPQuery qryBookings = new SPQuery(); ...
0
votes
1answer
91 views

SPQUERY returns null value

Hi im using sp query to retrieve the items and using projectproperty.Title to get the web name dynamically ,but I got empty value in this data table. q.ViewFields = "<FieldRef Name='...
2
votes
0answers
108 views

Join SPQuery in list

List 1 "Posts", fields Title body #comments modified in this list #comments fields is look up from another list Comments: List 2 "Comments", fields title body comments post ...
0
votes
1answer
1k views

Join two list using multivalued lookup field with spquery

I have joined two lists with the lookup that allow single value using spquery.join. can any one help me to do for multivalue lookup
0
votes
1answer
181 views

Performance : Caml query taking long time to load or something else

I have a CAML query which provides a result, if a SPfolder exists or not. When i do the item.Count it takes around 2sec for the line to execute . What is going wrong and taking long time to execute ...
0
votes
1answer
304 views

Powershell : Query Document Exclude Document Set

I have a Document Library contains multiple Document Sets, each of the Document Sets contains Files. Document Library ----> Document Set ----> Files My objective is to query all File Name only ...
0
votes
2answers
894 views

Filter List for DateTime using CAML against Calculated Field

In WSS 3.0, I have a list with a Calculated Field, 'MaxDate'. It gets the greater of two other dates, Notional Date and Override Date. I am trying (and failing) to build a CAML query to get all items ...
1
vote
4answers
5k views

Sharepoint 2010 SPQuery to join two custom lists

I have two custom lists. list 1 having following columns: ID (consider as PK) title list 2 having following columns NID (lookup column) title I'm using spquery.joins like below <Joins> &...
1
vote
1answer
153 views

Best way of retrieving a collection of SPSite in code

I have a page where the user will be entering a data in a textbox, and click submit, and it brings all site collections that url contains this data in textbox, I am currenlty doing a Linq query to ...
3
votes
2answers
842 views

SPQuery - Which fields (ViewFields) are required to Update the list item?

In an SPQuery, which fields are required to update a list item? SPQuery query = new SPQuery(); query.Query = @" <OrderBy> <FieldRef Name='ID' Ascending='true' /> </...
2
votes
2answers
829 views

Sharepoint field not found exception

I am querying a SPList in sharepoint 2010 and populating the corresponding grid view: <asp:DataGrid runat="server" ID="gridView" AutoGenerateColumns="false" AlternatingRowStyle-BackColor="...
0
votes
1answer
6k views

Get the SPListItems using SPList.GetItems(SPQuery)

I have a requirement of filtering the data from the SPList (ex:20000 SPListItems) and I bind it to the radgrid. I want to get first 200 and next 200 of every page click in the radgrid. This is my ...
1
vote
1answer
86 views

Is there any benefit of using multiple lists to store documents versus a single library in large lists?

Background: We are migrating a legacy system into Sharepoint and will look to migrate around 300 000 documents. There is some metadata which inherently diferentiates the documents from eachother. ...
0
votes
1answer
249 views

CAML query to select users IDs

I'm trying to select users ids from custom tasks lists. All users are in one SP Group and I need to collect users Ids that doesn't have tasks. query.Query = string.Format("<And><Membership ...
2
votes
1answer
2k views

SharePoint 2013 list items paging

I'm trying to make a webpart with list items paging. I followed this link http://www.directsharepoint.com/2011/03/step-by-step-guide-to-implement-paging.html and on SharePoint 2010 server it works ...
0
votes
1answer
201 views

How to list all alements by CAML to SPGridView

Is it possible to display the listitems retrieved from a CAML query in a SPGridView? How can I implement it?
0
votes
1answer
34 views

quick way to access splistitem in different list?

I have 2 lists: listA and listB listA has 2 fields: Title (text) PortalID (text) listB has 3 fields: Title (text), listAField(lookup to listA Title field) UserID (text) I have a UserID value ...
3
votes
2answers
2k views

SPQuery works on libraries under the list view threshold, but not over

So I am building a webpart which enumerates all doclibs in the current web, grabbing all checked out files and listing them in a table, allowing a user to apply some required metadata and check in ...
3
votes
2answers
2k views

Get SPQuery TotalItems from query

I want to get the total number of items that match my Query, BUT also limit the results. So say I have 100 items in the list. 50 of the 100 items in the list match my query. I want to only get 10 ...
1
vote
1answer
724 views

How do I select only top level folders using CrossListQueryCache?

I want to select the list of folders (without subfolders, not recursive) of a Document library using CrossListQueryCache. Everything is working fine except that i am receiving ALL the folders and ...
1
vote
1answer
796 views

SPQuery on null lookupfield

I have a contact list with a company lookup field and I need to retrieve those without any company associated so I was thinking can I put it like this: <Query> <OrderBy> &...
2
votes
1answer
2k views

Caml Query - skip X first results

Let's assume I have list with 100 items. Is it possible to write CAML query to get 5 items, but skip 10 items from the beggining? Something like LIMIT and OFFSET in SQL?
0
votes
4answers
6k views

Detected use of SPRequest for previously closed SPWeb object after SPQuery

this code run yesterday very well and today I've been trying to solve this error for hour now : Please close SPWeb objects when you are done with all objects obtained from them, but not before I ...
1
vote
0answers
321 views

SPSiteDataQuery without subfolder items?

I'm trying to use the SPSiteDataQuery to return the contents of several lists across a site collection. The problem I'm having, though, is that while there are only a few documents at the root level ...
2
votes
1answer
3k views

How to Set SPQuery.RowLimit to get all items?

I'm using my SPList View to get the html code of extracted items by an SPQuery over the listview SPList myList = mySite.RootWeb.Lists.GetByInternalName("ListINStr"); SPView oView = myList.Views["...
5
votes
2answers
610 views

SPQuery returning different before and after using RunWithElevatedPrivileges method

I am having a huge problem here. I am executing a query looking for a SPListItem, when I execute this query with user identity it works well, retuning the fields "Author" and "Editor" that I need. ...
1
vote
2answers
998 views

SPQuery always returns values

I am trying to check a list for related values but for some reason every item in the list is returned each time. I have seen this issue before and for me its always meant a bad CAML string but I have ...
0
votes
2answers
208 views

Dynamic SPQuery

I want to build search criteria by using SPQuery object that searches a list. On application page, there are two textbox Controls, 2 combobox Controls and 2 people picker Controls. The search criteria ...
2
votes
0answers
53 views

Mysterious DBCS (Double-Byte-Characters), i.e Kanji from SiteData query

Records returned from SPWeb.GetSiteData have some fields encoded in DBCS (Kanji characters). What could be causing this?
5
votes
1answer
2k views

SPList.GetItems query returning an invalid SPListItemCollection. What am I doing wrong?

I'm trying to query an SPList object using a CAML query (see code below). SPQuery queryGetExistingTargetTask = new SPQuery(); queryGetExistingTargetTask.Query = string.Format(@"<Where><Eq&...