SPRegionalSettings constructor (SPWeb)
Initializes a new instance of the SPRegionalSettings class for the specified Web site.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaration
Public Sub New ( _
web As SPWeb _
)
'Usage
Dim web As SPWeb
Dim instance As New SPRegionalSettings(web)
public SPRegionalSettings(
SPWeb web
)
Parameters
web
Type: Microsoft.SharePoint.SPWebAn SPWeb object that represents the Web site from which to retrieve regional settings.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | web is null . |
Remarks
You can use either the SPRegionalSettings constructor or the RegionalSettings property to retrieve a regional settings object for a specified Web site.
Examples
The following code example shows how to retrieve regional settings for the root Web site of a site collection.
Dim siteCollection As New SPSite("https://localhost")
Try
Dim rootWebSite As SPWeb = siteCollection.RootWeb
Dim regionalsettings As New SPRegionalSettings(rootWebSite)
…
rootWebSite.Dispose()
Finally
siteCollection.Dispose()
End Try
using (SPSite oSiteCollection = new SPSite("https://localhost"))
{
using(SPWeb oWebsiteRoot = oSiteCollection.RootWeb)
{
SPRegionalSettings oRegionalSettings = new SPRegionalSettings(oWebsiteRoot);
...
}
}
Note
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.