SPWebApplicationBuilder 类
创建一个SPWebApplication对象,它提供的所有所需的值 ; 默认设置这样一来,调用方只必须更改不同的属性值从默认值。
继承层次结构
System.Object
Microsoft.SharePoint.Administration.SPWebApplicationBuilder
命名空间: Microsoft.SharePoint.Administration
程序集: Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)
语法
声明
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
Public Class SPWebApplicationBuilder
用法
Dim instance As SPWebApplicationBuilder
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public class SPWebApplicationBuilder
示例
下面的示例使用SPWebApplicationBuilder在 999 端口上创建一个新的 SharePoint Web 应用程序。本示例创建并设置 Web 应用程序,然后在根目录中创建一个新网站和顶级网站。
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();
线程安全性
该类型的任何公共 静态 (已共享 在 Visual Basic 中) 成员都是线程安全的。不保证任何实例成员都是线程安全的。