I have created a subsite and imported a list, from the original site, and inserted it as a web part.

Is it possible to modify this web part view so I can only show items that has the same name as the subsite?

For example: The subsite name is Test 23. In that list web part, there are items from Test 1 to Test 50. I want to show only item Test 23 (that is the subsite name).

How can I do that? Any idea?


PS: I have several subsites. It is virtually impossible to change manually every web part. My idea is to create a subsite model with that configuration.

1 Answer 1


As I understand , you have a list with a column contains subsite name , so you can use filter at view

  • Go to your list
  • Modify view from the above ribbon.

enter image description here

  • At filter , Select you column equal to Test 23

enter image description here


I agree with you to create a site template , and when you create a subsite you can run the following script at your list to create a filter using PowerShell Script.

$web = Get-SPWeb -Identity "http://RootSite/subsite"
$list = $web.GetList("http://RootSite/subsite/Lists/YourList")
$query = "<Where><Eq><FieldRef Name='subsite' /><Value Type='Text'>Test 23</Value></Eq></Where>"    
$view = $list.DefaultView;
$view.Query = $query

You can also do foreach for all lists if you are sure this field already exists at all Site List


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.