SPRegionalSettings.CalendarType property
取得或設定用於伺服器的行事曆類型。
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Public Property CalendarType As Short
Get
Set
'用途
Dim instance As SPRegionalSettings
Dim value As Short
value = instance.CalendarType
instance.CalendarType = value
public short CalendarType { get; set; }
Property value
Type: System.Int16
16 位元整數,指定行事曆的類型。
備註
CalendarType屬性可接受下列 integer 值:
0 -無
1 — 西曆
3 — 日本天皇曆
5 — 韓文 (檀紀)
6 — 回曆
7 — 泰曆
8 — 希伯來陰曆
9 — 西曆中東法文行事曆
10 — 阿拉伯文西曆
11 — 音譯英文西曆
12 — 音譯法文西曆
16 — 塞迦曆
如果屬性設為任何其他值,會使用西曆。
Examples
下列程式碼範例會設定行事曆類型的網站以回曆,並增加 2 的天數。
Dim siteCollection As New SPSite("https://localhost")
Try
Dim rootWebSite As SPWeb = siteCollection.RootWeb
Dim regionalsettings As SPRegionalSettings = rootWebSite.RegionalSettings
regionalsettings.CalendarType = 6
regionalsettings.AdjustHijriDays = 2
rootWebSite.Update()
rootWebSite.Dispose()
Finally
siteCollection.Dispose()
End Try
[C#]
using (SPSite oSiteCollection = new SPSite("https://localhost"))
{
using(SPWeb oWebsiteRoot = oSiteCollection.RootWeb)
{
SPRegionalSettings oRegionalSettings = oWebsiteRoot.RegionalSettings;
oRegionalSettings.CalendarType = 6;
oRegionalSettings.AdjustHijriDays = 2;
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. |