For later use

SharePoint 2010: Iterate all webs in Web Application

posted Aug 31, 2015, 3:07 AM by Benny Skogberg

Sometimes you're just there and need to do something with all of your SPWebs, but have the unfortunate structure of having http://Portal/Sites/SiteCollections in your architecture. There is a way out which is quite simple and working very well. All you need to do is to get hold of all the SiteCollections (SPSite) in the WebApplication (http://portal).