Consider this SharePoint site hierarchy:
- Site Collection
- Site1
- Subsite1
- AnotherSubsite1
- Page1
- Page2
- AnotherSubsite2
- Subsite2
- Page3
- Page4
- Site2
You can assume that every Site in the above hierarchy has a default page.
If I place a CQWP on Site1’s default page, can I instruct it to start getting data one level below where it was placed? i.e. ignore the page/site it’s currently on, so that it returns:
- Subsite1
- AnotherSubsite1
- Page1
- Page2
- AnotherSubsite2
- Subsite2
- Page3
- Page4
Thank you
I would extend the CQWP and then hook up my own ProcessDataDelegate to remove the data that’s not required. For example:
The WebId column in
datais the GUID for the SPWeb object of each returned item. Look up SPWeb.ID of the sites you no longer want and then remove these rows. Note that the GUIDs in the WebId column are upper-case and in “D” format as described in Guid.ToString().Remember to use
AcceptChanges()at the end to ensure the DataTable is updated.