Share via


SPRegionalSettings.ShowWeeks property

Gets or sets a Boolean value that specifies whether to display the week number in day or week views of a calendar.

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

Syntax

'Declaration
Public Property ShowWeeks As Boolean
    Get
    Set
'Usage
Dim instance As SPRegionalSettings
Dim value As Boolean

value = instance.ShowWeeks

instance.ShowWeeks = value
public bool ShowWeeks { get; set; }

Property value

Type: System.Boolean
true to display weeks on the calendar; otherwise, false.

Examples

The following code example sets the calendar type to Gregorian and enables display of the week number.

Dim siteCollection As New SPSite("https://localhost")
Try
    Dim rootWebSite As SPWeb = siteCollection.RootWeb
    Dim regionalsettings As SPRegionalSettings = rootWebSite.RegionalSettings
    regionalsettings.CalendarType = 0
    regionalsettings.ShowWeeks = True

    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; 
        oRegionalSettings.CalendarType = 0; 
        oRegionalSettings.ShowWeeks = true; 
        oWebsiteRoot.Update(); 
    }
}

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.

See also

Reference

SPRegionalSettings class

SPRegionalSettings members

Microsoft.SharePoint namespace