Compartilhar via


SPRegionalSettings.Locales property

Obtém a coleção de localidades usada em um farm de servidores.

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

Syntax

'Declaração
Public ReadOnly Property Locales As SPLocaleCollection
    Get
'Uso
Dim instance As SPRegionalSettings
Dim value As SPLocaleCollection

value = instance.Locales
public SPLocaleCollection Locales { get; }

Property value

Type: Microsoft.SharePoint.SPLocaleCollection
Um objeto SPLocaleCollection que representa as localidades.

Examples

O exemplo de código a seguir exibe todas as localidades que são representadas no site raiz.

Dim siteCollection As New SPSite("https://localhost")
Try
    Dim rootWebSite As SPWeb = siteCollection.RootWeb
    Dim regionalsettings As SPRegionalSettings = rootWebSite.RegionalSettings
    Dim locales As SPLocaleCollection = regionalsettings.Locales

    Dim local As SPLocale
    For Each local In  locales
        Console.WriteLine(local.DisplayName)
    Next local

    rootWebSite.Dispose()
Finally
    siteCollection.Dispose()
End Try
using (SPSite oSiteCollection = new SPSite("https://localhost"))
{
    using (SPWeb oWebsiteRoot = oSiteCollection.RootWeb)
    {
        SPRegionalSettings oRegionalSettings = oWebsiteRoot.RegionalSettings;
        SPLocaleCollection collLocalesAvailable = oRegionalSettings.Locales;

        foreach (SPLocale oLocaleAvailable in collLocalesAvailable)
        {
            Console.WriteLine(oLocaleAvailable.DisplayName);
        }
    }
}

Dica

Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Disposing Objects.

Ver também

Referência

SPRegionalSettings class

SPRegionalSettings members

Microsoft.SharePoint namespace