kamagra how much to take

Enumerating All SPWebs In SPFarm.Local Into Strongly Typed Collection

So when enumerating the SPWebs within a SPFarm to build a strongly typed SPWeb collection for whatever purpose your enumeration might look like this:

  1. public static List<SPWeb> WebsPreppedForIteration()
  2. {
  3. var collection = new List<SPWeb>();
  4. foreach (SPSite x in SPFarm.Local.Services.OfType<SPWebService>().SelectMany
  5. (svc => ((svc).WebApplications.Where
  6. (webApp => !webApp.Properties.ContainsKey("Microsoft.Office.Server.SharedResourceProvider")).SelectMany
  7. (webApp => webApp.Sites.Cast<SPSite>()))).Where
  8. (x => !Equals(x.RootWeb.Title, "Central Administration")))
  9. {
  10. collection.AddRange(x.RootWeb.Webs.Cast<SPWeb>());
  11. }
  12. return collection;
  13. }

I saw this in a code review today. The part I am wondering about is the SPWebApplication property bag to query the key for WCAM as opposed to do a clunky string SPWeb.Title comparison. Putting the keys out to standard output hasn’t yielded anything particularly evident, and I’m getting frustrated with the under-the-hood, unnecessary foreach loop with a fancy shirt on (the second LINQ query against the Title property(,

Does anyone know the key for WCAM?


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>