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.StringA string that contains the prefix. This is a server-relative URL path that cannot be longer than MaxPrefixLength.
type
Type: Microsoft.SharePoint.Administration.SPPrefixTypeAn SPPrefixType value that specifies the type of prefix.
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);