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)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
Syntax
'Declaration
Public Property FirstDayOfWeek As UInteger
Get
Set
'Usage
Dim instance As SPRegionalSettings
Dim value As UInteger
value = instance.FirstDayOfWeek
instance.FirstDayOfWeek = value
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
Remarks
The FirstDayOfWeek property throws an exception if the value is not between 0 and 6.
Examples
The following code example sets the first day of the week that is used in calendars to Thursday.
Dim siteCollection As New SPSite("https://localhost")
Try
Dim rootWebSite As SPWeb = siteCollection.RootWeb
Dim regionalsettings As SPRegionalSettings = rootWebSite.RegionalSettings
regionalsettings.FirstDayOfWeek = 4
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.FirstDayOfWeek = 4;
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.