kamagra how much to take

Return IIS Settings For A SP Zone

There was a question in the SharePoint development newsgroups as to how someone might go about getting specific IIS settings when wanting to target an arbitrary SharePoint zone from which to query those settings. Fortunately, within the SharePoint object model, this is feasible using the GetIisSettingsWithFallBack method out of SPWebApplication. For example, this method is helpful when you want to retrieve something like a file that exists at the root of your SharePoint web application. For example, let’s write a small example method that will allow us to harness the web.config file for an arbitrary zone, which we will specify using the SPUrlZone enumeration. The SPUrlZone enumeration contains all the neccesary member values for working with the zones as they exist within your SharePoint instance, including custom, default, extranet, internet, and intranet. In this case, let’s start with something simple, namely the default member. Let’s start off this method by declaring a simple field, just an empty string, and within the parameters of the method, lets pass in a SPWebApplication object so that we can call the required methods.

  1. private void UsingGetIisSettingsWithFallBack(SPWebApplication myWebApplication)
  2. {
  3. string filename = string.Empty;
  4. }

Now that we have a small string field setup to hold the value, we can use the GetIisSettingWithFallback in order to harness the web.config by specifying the default zone, and then getting the full path to the required file.

  1. private void UsingGetIisSettingsWithFallBack(SPWebApplication myWebApplication)
  2. {
  3. string myReturn = string.Empty;
  4. myReturn = myWebApplication.GetIisSettingsWithFallback(SPUrlZone.Default).GetPath().FullName + @"\web.config";
  5. }

And that’s it! If you wanted to take it a step further, you can declare a new XmlDocument object in order to hold the string value. You can do this by simply instantiating said object, and then use the load method out of XmlDocument (in combination with an SPWebConfigModification object, which you should just pass in as a parameter), like this:

  1. private void UsingGetIisSettingsWithFallBack(SPWebApplication myWebApplication)
  2. {
  3. string myReturn = string.Empty;
  4. XmlDocument myDocument = new XmlDocument();
  5.  
  6. myReturn = myWebApplication.GetIisSettingsWithFallback(SPUrlZone.Default).GetPath().FullName + @"\web.config";
  7. document.Load(myReturn);
  8.  
  9. }

Which will really let you start with the fun stuff!

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>