SPRegionalSettings.TimeZone property
Obtém o fuso horário usado no servidor.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaração
Public Property TimeZone As SPTimeZone
Get
Friend Set
'Uso
Dim instance As SPRegionalSettings
Dim value As SPTimeZone
value = instance.TimeZone
public SPTimeZone TimeZone { get; internal set; }
Property value
Type: Microsoft.SharePoint.SPTimeZone
Um objeto SPTimeZone que representa o fuso horário.
Examples
O exemplo de código a seguir retorna o fuso horário de Indiana por meio da propriedade TimeZones e, em seguida, atribui o fuso horário para o site raiz do conjunto de sites especificado.
Dim siteCollection As New SPSite("https://localhost")
Try
Dim rootWebSite As SPWeb = siteCollection.RootWeb
Dim regionalsettings As SPRegionalSettings = rootWebSite.RegionalSettings
Dim IndianaEastTZ As SPTimeZone = regionalsettings.TimeZones(15)
regionalsettings.TimeZone.ID = IndianaEastTZ.ID
rootWebSite.Update()
rootWebSite.Dispose()
Finally
siteCollection.Dispose()
End Try
using (SPSite oSiteCollection = new SPSite("https://localhost"))
{
using(SPWeb oWebsiteRoot = oSiteCollection.RootWeb)
{
SPRegionalSettings oRegionalSettings = oWebsiteRoot.RegionalSettings;
SPTimeZone oTimeZoneIndianaEast = oRegionalSettings.TimeZones[15];
oRegionalSettings.TimeZone.ID = oTimeZoneIndianaEast.ID;
oWebsiteRoot.Update();
}
}
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.