SPWebApplicationBuilder Class

Creates an SPWebApplication object, providing default settings for all the required values and allowing the caller to change only those properties that need values that are different from the default.

Inheritance Hierarchy


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


<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public Class SPWebApplicationBuilder

Dim instance As SPWebApplicationBuilder
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public class SPWebApplicationBuilder


The following example uses the SPWebApplicationBuilder to create a new SharePoint Web application on port 999. The example creates and provisions a Web application, and then it 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()


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

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


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


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


SPWebApplicationBuilder Members

Microsoft.SharePoint.Administration Namespace