Export (0) Print
Expand All

SPRegionalSettings.FirstDayOfWeek property

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

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

public uint FirstDayOfWeek { get; set; }

Property value

Type: System.UInt32
An unsigned 32-bit integer that indicates the first day of the week. The following values are possible:
  • 0 -- Sunday

  • 1 -- Monday

  • 2 -- Tuesday

  • 3 -- Wednesday

  • 4 -- Thursday

  • 5 -- Friday

  • 6 -- Saturday

The FirstDayOfWeek property throws an exception if the value is not between 0 and 6.

The following code example sets the first day of the week that is used in calendars to Thursday.

using (SPSite oSiteCollection = new SPSite("http://localhost"))
{
    using (SPWeb oWebsiteRoot = oSiteCollection.RootWeb)
    {
        SPRegionalSettings oRegionalSettings = oWebsiteRoot.RegionalSettings;
        oRegionalSettings.FirstDayOfWeek = 4;
        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.

Show:
© 2014 Microsoft