Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
add comment

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

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
add comment

Your Answer

 
discard

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.