kamagra how much to take

Use LINQ To Get Central Administration Web Applications

I needed a quick and dirty way to go through the SPWebService.AdministrationService to get a collection SPWebService.WebApplications and then test whether the SPWebApplication is the Central Administration application. To do this you need to use the SPWebApplication.IsAdministrationWebApplication boolean property. To keep things succinct you can just chain a LINQ query to return the representative SPSite of the desired administrative SPWebApplication. Consider the following RetrieveAdminApplication method that is consuming a SPContext object as a parameter:

  1. public static SPSite RetrieveAdminApplication(SPContext context)
  2. {
  3. return SPWebService.AdministrationService.WebApplications.Cast().
  4. Where(application => application.IsAdministrationWebApplication).FirstOrDefault().
  5. Sites.Cast().FirstOrDefault();
  6. }

This is probably not ideal, but will work!

Share

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>