If I have a certain number of webs within my site collection, and those web have set some property, eg. web.Properties["foo"] = "bar". I'd like to get list of all the webs which have property foo set to bar. How can I do that?

One way is to iterate through all webs, but that doesn't seem efficient. What other possibilities do I have?

1 Answer 1


If you have control of the property setting code of the web, you could have a quasi "index" in the RootWeb, which contains a csv or a list of webs with property values.

Then, to find webs with specific properties, all you need to do is query a property from the RootWeb (which is a property from the SPSite so you don't need to do a search).

  • looks interesting. How about SPPropetyBag limits? I estimate that there will be few thousand of webs.
    – jjczopek
    Commented Jul 31, 2012 at 8:10
  • That's a lot of webs. Maybe storing the "index" in the property bag is not the best solution. You could store this index in a sharepoint list perhaps?
    – Russell
    Commented Aug 1, 2012 at 0:50

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.