This topic has not yet been rated - Rate this topic

SPWebApplicationBuilder Class

Creates an SPWebApplication object, which provides default settings for all the required values; that way, the caller must only change the property values that vary from the default.

System.Object
  Microsoft.SharePoint.Administration.SPWebApplicationBuilder

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public class SPWebApplicationBuilder

The following example uses SPWebApplicationBuilder to create a new SharePoint Web application on port 999. The example creates and provisions a Web application, and then creates a new site collection and top-level site at the root.

SPWebApplicationBuilder webAppBuilder = new SPWebApplicationBuilder(SPFarm.Local);
int myPort = 999;
webAppBuilder.Port = myPort;
SPWebApplication newApplication = webAppBuilder.Create();

newApplication.Provision();

SPSite mySiteCollection = newApplication.Sites.Add("/", "DOMAIN\\UserAlias", "user@microsoft.com");

mySiteCollection.Close();
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ