共用方式為


SPRegionalSettings.FirstWeekOfYear property

取得或設定伺服器上的行事曆中使用的一年第一週。

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

Syntax

'宣告
Public Property FirstWeekOfYear As Short
    Get
    Set
'用途
Dim instance As SPRegionalSettings
Dim value As Short

value = instance.FirstWeekOfYear

instance.FirstWeekOfYear = value
public short FirstWeekOfYear { get; set; }

Property value

Type: System.Int16
16 位元整數,會指定一年的第一週。

備註

如果值不是介於 0 和 2 FirstWeekOfYear屬性會擲回例外狀況。

Examples

下列程式碼範例會設定為年的第一個完整週年的第一週。

Dim siteCollection As New SPSite("https://localhost")
Try
    Dim rootWebSite As SPWeb = siteCollection.RootWeb
    Dim regionalsettings As SPRegionalSettings = rootWebSite.RegionalSettings
    regionalsettings.FirstWeekOfYear = 1

    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.FirstWeekOfYear = 1;
        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.

請參閱

參照

SPRegionalSettings class

SPRegionalSettings members

Microsoft.SharePoint namespace