共用方式為


SPPrefixCollection class

代表SPPrefix物件的集合。

Inheritance hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPAutoSerializingObject
    Microsoft.SharePoint.SPBaseCollection
      Microsoft.SharePoint.Administration.SPPrefixCollection

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

Syntax

'宣告
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
Public Class SPPrefixCollection _
    Inherits SPBaseCollection _
    Implements IEnumerable(Of SPPrefix), IEnumerable
'用途
Dim instance As SPPrefixCollection
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public class SPPrefixCollection : SPBaseCollection, 
    IEnumerable<SPPrefix>, IEnumerable

備註

當 Web 伺服器會接收到此 Web 應用程式要求時, Microsoft SharePoint Foundation會查看來決定SharePoint Foundation或網際網路資訊服務 (IIS) 時,是否處理要求的要求的 URL 路徑。包含指定哪些 URL 路徑都是由SharePoint Foundation處理。不需要指定 IIS 所處理的 URL 路徑 — 裝載此 Web 應用程式的 IIS 工作者處理序啟動時,其會尋找檔案、 資料夾及虛擬目錄的此 Web 應用程式的主目錄,並自動排除那些都會將會由 IIS 處理。

使用PrefixesPrefixes ,傳回集合的 Web 應用程式前置詞。若要新增前置字元,請使用Add方法。

若要從集合中傳回單一的前置詞使用索引器。例如,若集合已指派給變數myPrefixes,使用myPrefixes[index]以 C# 或 Visual Basic,其中index是索引編號的前置詞的集合中的myPrefixes(index) 。

Examples

下列範例會將由SharePoint Foundation處理的 URL 路徑的集合的 URL 路徑。此 URL 路徑可以架設其下方的多個網站集合。

Dim myPrefix As String = "Path"

Dim webApplication As SPWebApplication = _
   SPWebApplication.Lookup(New Uri("http://machinename"))
Dim prefixCollection As SPPrefixCollection = webApplication.Prefixes

If prefixCollection.Contains(myPrefix) = False Then
    prefixCollection.Add(myPrefix, SPPrefixType.WildcardInclusion)
End If
string myPrefix = "Path";

SPWebApplication webApplication = 
   SPWebApplication.Lookup(new Uri("http://machinename"));
SPPrefixCollection prefixCollection = webApplication.Prefixes;

if (prefixCollection.Contains(myPrefix) == false)
{
    prefixCollection.Add(myPrefix, SPPrefixType.WildcardInclusion);
}

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.

請參閱

參照

SPPrefixCollection members

Microsoft.SharePoint.Administration namespace