Some problems in using spsitedataquery.

Source: Internet
Author: User

Spsitedataquery can be used for cross-site and cross-list queries in the same site collection. Using this class, you can conveniently collect statistics on a certain type of documents. Especially when Content Query Web parts cannot be used.

I also encountered some interesting problems during the use process. Here is a record and summary.

1. How to include the content type and its subtypes when querying by content type.

<Where>
<Beginswith>
<Fieldref name = "contenttypeid"/>
<Value type = "text"> 0x0101 </value>
</Beginswith>
</Where>

One trick here is to use a rule generated by content type IDs.

The default contenttypeid. For details, refer to base content type hierarchy.

2. No results are returned when you query the document library.

By default, spsitedataquery only queries the content of all lists. This is because of the default lists attribute. The default value of list is <lists basetype = "0"/>, which indicates searching all lists.

To search for spsitedataquery, set <lists basetype = "1"/>.

The following lists some default values. For more information, see spsitedataquery. Lists property.

Value

Description

0

generic list

1

document library

3

Discussion Forum

4

vote or survey

5

Issues List

3. The contents of the subwebsite cannot be found.

By default, spsitedataquery only queries the content of the current website. This is because of the default webs attribute. If you search for this website set, you can set it to <webs scope = "sitecollection"/>

For more information, see spsitedataquery. webs property.

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.