Cross-site cross-list query spsitedataquery

Source: Internet
Author: User

Sharepoint2010 official reference spsitedataquery

Moss_tan_jun spatial spsitedataquery usage instructions

Wss3.0 official reference spsitedataquery

 

Name Description
Lists Gets or sets the inner XML that specifies which lists to include in the query.
Query Gets or sets the inner XML that defines the query.
Rowlimit Gets or sets a limit for the number of items in the query that are returned per page.
Viewfields Gets or sets the inner XML that describes the View fields used in the query.
Webs Gets or sets the inner XML that specifies which web sites to include in the query. As specified byScopeAttribute onWebsTag in the query. By default, the query considers the current web site, that is, the web site from which

Add attribute description

1. Lists

You can use the <lists/> attribute to specify the list to be queried.

Servertemplate and basetype to define the list range. You can also use its sub-element <list id = "XXX"> to specify a specific list.

As for hidden and maxlistlimit, msdn makes it clear.

In particular, the <lists/> sub-element

<Withindex fieldid = "fieldid" type = "text" value = "XX"/>Type must be text,

Query the list of fields with fieldid "fieldid" indexed and with the field value "XX"

This is my test. Can I only query fields whose type is text ,????

For example, query all entries with fieldid = spbuiltinfieldid. Title, indexed, and splitsitem whose field value is infotest1

Why does the query provide such a speed .....

Code

Spsitedataquery sdquery = new spsitedataquery ();
Splist info2 = site. rootweb. Lists ["info2"];
Splist infolist = site. rootweb. Lists ["infolist"];
Sdquery. Lists =
"<Lists>"
// + "<List id = \" "+ info2.id. tostring () +" \ "/>"
// + "<List id = \" "+ infolist. Id. tostring () +" \ "/>"
+ "<Withindex fieldid = \" "+ spbuiltinfieldid. Title +" \ "type = \" text \ "value = \" infotest1 \ "/>"
+ "</Lists> ";
Sdquery. query =
"<Where>"
+ "<Contains>"
+ "<Fieldref name = \" title \ "/>"
+ "<Value type = \" text \ ">" + "info" + "</value>"
+ "</Contains>"
+ "</Where> ";
Sdquery. viewfields = "<fieldref name = \" title \ "/> ";
Datatable dt = site. rootweb. getsitedata (sdquery );

 

2. Query

The syntax is consistent with that of spquery.

3. rowlimit

Limit

4. viewfields

In addition, three columns will be returned for you.

Webid: ID of the spweb in which the list is located

Listid: ID of the splist in which splistitem is located

ID: splistitem ID

Fields to be returned, case sensitive.

If the queried list does not contain a field in viewfields, no data is found in this list..
 If the field in your list is similar to webid or listid, regardless of case, the webid and listid returned by the system will be the actual values in your list column. Therefore, when you name the field, think twice.

.

5. Webs

Three values

<Webs scope = "sitecollection"/>, which includes all the websites (spweb) and sub-websites (spweb) under the current website set)

<Webs scope = "recursive"/>, including the current website and all its subwebsites

By default, only the current spweb

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.