Deleting Web Application




Go back to index

How to delete web application


Following code block explains how to programmatically delete a web application from Sharepoint Farm.

      using System;
      using SPTool.Library;
      using System.Collections.ObjectModel;
 
      namespace SPTool.Test
      {
          class Program
          {
              static void Main(string[] args)
              {
                  // Delete web application
                  SPTReturn returnObj = farm.DeleteWebApplication(new Uri("http://sptool/"),true,true);

                  // Check the status of web application deletion
                  if (returnObj.State == SPTState.Success)
                  {
                      // Successfully deleted web application
                  }
                  else
                  {
                      // Deleting web application failed
                  }
              }
          }
      }


Go back to index