共用方式為


SPRegionalSettings.AlternateCalendarType Property

Gets or sets an alternate calendar type that is used 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 AlternateCalendarType As Short
    Get
    Set
'Usage
Dim instance As SPRegionalSettings
Dim value As Short

value = instance.AlternateCalendarType

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

Property Value

Type: System.Int16
A 16-bit integer that specifies the type of alternate calendar.

Remarks

The AlternateCalendarType property accepts the following integer values:

  • 0 — None

  • 1 — Gregorian

  • 3 — Japanese Emperor Era

  • 5 — Korean Tangun Era

  • 6 — Hijri

  • 7 — Buddhist

  • 8 — Hebrew Lunar

  • 9 — Gregorian Middle East French Calendar

  • 10 — Gregorian Arabic Calendar

  • 11 — Gregorian Transliterated English Calendar

  • 12 — Gregorian Transliterated French Calendar

  • 16 — Saka Era

If set to any other value, the Gregorian calendar is used.

Examples

The following code example sets the alternate calendar for a Web site to Buddhist.

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

    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.AlternateCalendarType = 7;
        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.

See Also

Reference

SPRegionalSettings Class

SPRegionalSettings Members

Microsoft.SharePoint Namespace