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.

Inheritance hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPWebApplicationBuilder

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public Class SPWebApplicationBuilder
'Usage
Dim instance As SPWebApplicationBuilder
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public class SPWebApplicationBuilder

Examples

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.

Dim webAppBuilder As New SPWebApplicationBuilder(SPFarm.Local)
Dim myPort As Integer = 999
webAppBuilder.Port = myPort
Dim newApplication As SPWebApplication = webAppBuilder.Create()

newApplication.Provision()

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

mySiteCollection.Close()
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();

Thread safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See also

Reference

SPWebApplicationBuilder members

Microsoft.SharePoint.Administration namespace