Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
CalendarType property

SPRegionalSettings.CalendarType property

Gets or sets the calendar type that is used on the server.

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

public short CalendarType { get; set; }

Property value

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

The CalendarType 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 the property is set to any other value, the Gregorian calendar is used.

The following code example sets the calendar type of a Web site to Hijri and increases the number of days by 2.

Dim siteCollection As New SPSite("http://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("http://localhost"))
{
    using(SPWeb oWebsiteRoot = oSiteCollection.RootWeb)
    {
        SPRegionalSettings oRegionalSettings = oWebsiteRoot.RegionalSettings; 
        oRegionalSettings.CalendarType = 6; 
        oRegionalSettings.AdjustHijriDays = 2; 

        oWebsiteRoot.Update(); 
    }
}
NoteNote

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.

Show:
© 2015 Microsoft