SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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).

share|improve this answer
looks interesting. How about SPPropetyBag limits? I estimate that there will be few thousand of webs. – jjczopek Jul 31 '12 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 Aug 1 '12 at 0:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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