SPPrefixCollection.Add method

Adds the specified prefix to the collection.

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

Syntax

'Declaration
Public Function Add ( _
    strPrefix As String, _
    type As SPPrefixType _
) As SPPrefix
'Usage
Dim instance As SPPrefixCollection
Dim strPrefix As String
Dim type As SPPrefixType
Dim returnValue As SPPrefix

returnValue = instance.Add(strPrefix, _
    type)
public SPPrefix Add(
    string strPrefix,
    SPPrefixType type
)

Parameters

  • strPrefix
    Type: System.String

    A string that contains the prefix. This is a server-relative URL path that cannot be longer than MaxPrefixLength.

Return value

Type: Microsoft.SharePoint.Administration.SPPrefix
An SPPrefix object.

Examples

The following example includes the specified path as a wildcard, meaning that multiple path-based site collections can be created below this URL path.

Dim webApplication As SPWebApplication.Lookup(new Uri("http://machinename"))
Dim prefixCollection As SPPrefixCollection = webApplication.Prefixes
prefixCollection.Add("Path", Microsoft.SharePoint.Administration.SPPrefixType.WildcardInclusion)
SPWebApplication webApplication = 
   SPWebApplication.Lookup(new Uri("http://machinename"));
SPPrefixCollection prefixCollection = webApplication.Prefixes;
prefixCollection.Add("Path", SPPrefixType.WildcardInclusion);

See also

Reference

SPPrefixCollection class

SPPrefixCollection members

Microsoft.SharePoint.Administration namespace