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)

public bool ShowWeeks { get; set; }

Property value

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

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

using (SPSite oSiteCollection = new SPSite("http://localhost"))
    using (SPWeb oWebsiteRoot = oSiteCollection.RootWeb)
        SPRegionalSettings oRegionalSettings = oWebsiteRoot.RegionalSettings; 
        oRegionalSettings.CalendarType = 0; 
        oRegionalSettings.ShowWeeks = true; 

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.