SPRegionalSettings.FirstDayOfWeek property
取得或設定伺服器上的行事曆中使用的一週第一天。
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Public Property FirstDayOfWeek As UInteger
Get
Set
'用途
Dim instance As SPRegionalSettings
Dim value As UInteger
value = instance.FirstDayOfWeek
instance.FirstDayOfWeek = value
public uint FirstDayOfWeek { get; set; }
Property value
Type: System.UInt32
正負號的 32 位元整數,指出該週的第一天。可能是下列值:
0 -星期日
1 -星期一
2 -星期二
3 -星期三
4 -星期四
5 -星期五
6 -星期六
備註
如果值不是介於 0 到 6 FirstDayOfWeek屬性會擲回例外狀況。
Examples
下列程式碼範例會設定使用中行事曆以星期四的週的第一天。
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();
}
}
注意事項 |
---|
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. |