0 out of 1 rated this helpful - Rate this topic

SPRegionalSettings.FirstWeekOfYear Property

Gets or sets the first week of the year used in calendars on the server.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
public short FirstWeekOfYear { get; set; }

Property Value

Type: System.Int16
A 16-bit integer that specifies the first week of the year.

The FirstWeekOfYear property throws an exception if the value is not between 0 and 2.

The following code example sets the first week of the year to be the first full week of the year.

using (SPSite oSiteCollection = new SPSite("http://localhost"))
{
    using (SPWeb oWebsiteRoot = oSiteCollection.RootWeb)
    {
        SPRegionalSettings oRegionalSettings = oWebsiteRoot.RegionalSettings;
        oRegionalSettings.FirstWeekOfYear = 1;
        oWebsiteRoot.Update();
    }
}
NoteNote

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.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Explanation of values
0 = Starts on Jan 1 $01 = First full week$0 $02 = First 4-day week (ISO8601 standard)$0 $0$0 $0 $0Note: The ISO8601 standard definition for weeks has FirstDayOfWeek = 1 (Monday), and FirstWeekOfYear = 2 (first week with 4 days).$0 $0$0 $0