Compartilhar via


SPWebCollection.Names property

Obtém uma matriz que contém as URLs de site relativa de todos os sites na coleção.

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

Syntax

'Declaração
Public ReadOnly Property Names As String()
    Get
'Uso
Dim instance As SPWebCollection
Dim value As String()

value = instance.Names
public string[] Names { get; }

Property value

Type: []
Uma matriz de cadeia de caracteres que contém as URLs de site relativa.

Examples

O exemplo de código a seguir exibe a URL de cada site no conjunto de sites atual.

Este exemplo requer using diretivas (Imports no Visual Basic) para os namespaces Microsoft.SharePoint e Microsoft.SharePoint.Utilities .

Dim siteCollection As SPSite = SPContext.Current.Site 
Dim webSites As SPWebCollection = siteCollection.AllWebs
Dim names As String() = webSites.Names
Dim name As String

For Each name In  names

    Response.Write(SPEncode.HtmlEncode(name) & "<BR>")

Next name
SPSite oSiteCollection = SPContext.Current.Site;
SPWebCollection collWebsites = oSiteCollection.AllWebs;
string[] strNames = collWebsites.Names;
foreach (string strName in strNames)
{
    Response.Write(SPEncode.HtmlEncode(strName) + "<BR>");
}

Ver também

Referência

SPWebCollection class

SPWebCollection members

Microsoft.SharePoint namespace