Quick little trick tonight for all you SharePoint configurators out there. Ever needed to use the Content by Query Webpart and query for just a single site? Yes? Well, then you probably ‘ve noticed there is no such option when configuring the webpart… right?
Wrong! There is a way to enable single site quering, and it’s actually not that hard. First thing you have to do is export your webpart to a file. Open your .webpart file and add (or replace the old one with) this little property:
<property name="WebsOverride" type="string"><Webs /;></property>
This property will, as its name suggests, override the webs property of the sitedataquery. By default the content by query webpart will fill this in with SiteCollection or Recursive. But if you don’t want this, just overwrite it with this (empty) Webs value.
After adjusting your file, upload it back to your page, and add an instance of your new webpart. And there you have it, single site goodness.
Hope it helps! Good night.