Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/provider/CalendarContract.Calendars#constants) \| [Inherited Constants](https://developer.android.com/reference/android/provider/CalendarContract.Calendars#inhconstants) \| [Fields](https://developer.android.com/reference/android/provider/CalendarContract.Calendars#lfields) \| [Inherited Methods](https://developer.android.com/reference/android/provider/CalendarContract.Calendars#inhmethods)

# CalendarContract.Calendars

*** ** * ** ***

` public static final class CalendarContract.Calendars `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/android/provider/BaseColumns, https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns, https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.provider.CalendarContract.Calendars |

<br />

*** ** * ** ***

Constants and helpers for the Calendars table, which contains details for individual calendars.

### Operations

All operations can be done either as an app or as a sync adapter. To perform an operation as a sync adapter `https://developer.android.com/reference/android/provider/CalendarContract#CALLER_IS_SYNCADAPTER` should be set to true and `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#ACCOUNT_NAME` and `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#ACCOUNT_TYPE` must be set in the Uri parameters. See `https://developer.android.com/reference/android/net/Uri.Builder#appendQueryParameter(java.lang.String,%20java.lang.String)` for details on adding parameters. Sync adapters have write access to more columns but are restricted to a single account at a time. Calendars are designed to be primarily managed by a sync adapter and inserting new calendars should be done as a sync adapter. For the most part, apps should only update calendars (such as changing the color or display name). If a local calendar is required an app can do so by inserting as a sync adapter and using an `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#ACCOUNT_TYPE` of `https://developer.android.com/reference/android/provider/CalendarContract#ACCOUNT_TYPE_LOCAL` .


**Insert**
:
    When inserting a new calendar the following fields must be included:

    - `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#ACCOUNT_NAME`
    - `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#ACCOUNT_TYPE`
    - `https://developer.android.com/reference/android/provider/CalendarContract.Calendars#NAME`
    - `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CALENDAR_DISPLAY_NAME`
    - `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CALENDAR_COLOR`
    - `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CALENDAR_ACCESS_LEVEL`
    - `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#OWNER_ACCOUNT`

    The following fields are not required when inserting a Calendar but are generally a good idea to include:

    <!-- -->

    - `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#SYNC_EVENTS` set to 1
    - `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CALENDAR_TIME_ZONE`
    - `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#ALLOWED_REMINDERS`
    - `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#ALLOWED_AVAILABILITY`
    - `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#ALLOWED_ATTENDEE_TYPES`


**Update**
:
    To perform an update on a calendar the `https://developer.android.com/reference/android/provider/BaseColumns#_ID` of the calendar should be provided either as an appended id to the Uri ( `https://developer.android.com/reference/android/content/ContentUris#withAppendedId(android.net.Uri,%20long)`) or as the first selection item--the selection should start with "_id=?" and the first selectionArg should be the _id of the calendar. Calendars may also be updated using a selection without the id. In general, the `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#ACCOUNT_NAME` and `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#ACCOUNT_TYPE` should not be changed after a calendar is created as this can cause issues for sync adapters.


**Delete**
:
    Calendars can be deleted either by the `https://developer.android.com/reference/android/provider/BaseColumns#_ID` as an appended id on the Uri or using any standard selection. Deleting a calendar should generally be handled by a sync adapter as it will remove the calendar from the database and all associated data (aka events).


**Query**
:
    Querying the Calendars table will get you all information about a set of calendars. There will be one row returned for each calendar that matches the query selection, or at most a single row if the `https://developer.android.com/reference/android/provider/BaseColumns#_ID` is appended to the Uri.

### Calendar Columns

The following Calendar columns are writable by both an app and a sync adapter.

- `https://developer.android.com/reference/android/provider/CalendarContract.Calendars#NAME`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CALENDAR_DISPLAY_NAME`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#VISIBLE`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#SYNC_EVENTS`

The following Calendars columns are writable only by a sync adapter

<!-- -->

- `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#ACCOUNT_NAME`
- `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#ACCOUNT_TYPE`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CALENDAR_COLOR`
- `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#_SYNC_ID`
- `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#DIRTY`
- `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#MUTATORS`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#OWNER_ACCOUNT`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#MAX_REMINDERS`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#ALLOWED_REMINDERS`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#ALLOWED_AVAILABILITY`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#ALLOWED_ATTENDEE_TYPES`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CAN_MODIFY_TIME_ZONE`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CAN_ORGANIZER_RESPOND`
- `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#CAN_PARTIALLY_UPDATE`
- `https://developer.android.com/reference/android/provider/CalendarContract.Calendars#CALENDAR_LOCATION`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CALENDAR_TIME_ZONE`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CALENDAR_ACCESS_LEVEL`
- `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#DELETED`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC1`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC2`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC3`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC4`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC5`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC6`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC7`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC8`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC9`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC10`

<br />

## Summary

| ### Constants ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/CalendarContract.Calendars#CALENDAR_LOCATION` The default location for the calendar. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/CalendarContract.Calendars#DEFAULT_SORT_ORDER` The default sort order for this table |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/CalendarContract.Calendars#NAME` The name of the calendar. |

### Inherited constants

From interface `https://developer.android.com/reference/android/provider/BaseColumns` `https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/BaseColumns#_COUNT`

The count of rows in a directory.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/BaseColumns#_ID`

The unique ID for a row.
From interface `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns` `https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#ALLOWED_ATTENDEE_TYPES`

A comma separated list of attendee types supported for this calendar in the format "#,#,#".
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#ALLOWED_AVAILABILITY`

A comma separated list of availability types supported for this calendar in the format "#,#,#".
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#ALLOWED_REMINDERS`

A comma separated list of reminder methods supported for this calendar in the format "#,#,#".
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CALENDAR_ACCESS_LEVEL`

The level of access that the user has for the calendar

Type: INTEGER (one of the values below)

<br />

`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CALENDAR_COLOR`

The color of the calendar.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CALENDAR_COLOR_KEY`

A key for looking up a color from the `https://developer.android.com/reference/android/provider/CalendarContract.Colors` table.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CALENDAR_DISPLAY_NAME`

The display name of the calendar.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CALENDAR_TIME_ZONE`

The time zone the calendar is associated with.
`int` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CAL_ACCESS_CONTRIBUTOR`

Full access to modify the calendar, but not the access control settings
`int` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CAL_ACCESS_EDITOR`

Full access to modify the calendar, but not the access control settings
`int` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CAL_ACCESS_FREEBUSY`

Can only see free/busy information about the calendar
`int` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CAL_ACCESS_NONE`

Cannot access the calendar
`int` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CAL_ACCESS_OVERRIDE`

not used
`int` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CAL_ACCESS_OWNER`

Full access to the calendar
`int` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CAL_ACCESS_READ`

Can read all event details
`int` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CAL_ACCESS_RESPOND`

Can reply yes/no/maybe to an event
`int` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CAL_ACCESS_ROOT`

Domain admin
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CAN_MODIFY_TIME_ZONE`

Can the organizer modify the time zone of the event? Column name.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CAN_ORGANIZER_RESPOND`

Can the organizer respond to the event? If no, the status of the organizer should not be shown by the UI.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#IS_PRIMARY`

Is this the primary calendar for this account.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#MAX_REMINDERS`

The maximum number of reminders allowed for an event.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#OWNER_ACCOUNT`

The owner account for this calendar, based on the calendar feed.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#SYNC_EVENTS`

Is this calendar synced and are its events stored on the device? 0 - Do not sync this calendar or store events for this calendar.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#VISIBLE`

Is the calendar selected to be displayed? 0 - do not show events associated with this calendar.
From interface `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns` `https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#ACCOUNT_NAME`

The account that was used to sync the entry to the device.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#ACCOUNT_TYPE`

The type of the account that was used to sync the entry to the device.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#CAN_PARTIALLY_UPDATE`

If set to 1 this causes events on this calendar to be duplicated with `https://developer.android.com/reference/android/provider/CalendarContract.EventsColumns#LAST_SYNCED` set to 1 whenever the event transitions from non-dirty to dirty.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#DELETED`

Whether the row has been deleted but not synced to the server.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#DIRTY`

Used to indicate that local, unsynced, changes are present.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#MUTATORS`

Used in conjunction with `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#DIRTY` to indicate what packages wrote local changes.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.SyncColumns#_SYNC_ID`

The unique ID for a row assigned by the sync source.
From interface `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns` `https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC1`

Generic column for use by sync adapters.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC10`

Generic column for use by sync adapters.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC2`

Generic column for use by sync adapters.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC3`

Generic column for use by sync adapters.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC4`

Generic column for use by sync adapters.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC5`

Generic column for use by sync adapters.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC6`

Generic column for use by sync adapters.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC7`

Generic column for use by sync adapters.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC8`

Generic column for use by sync adapters.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/CalendarContract.CalendarSyncColumns#CAL_SYNC9`

Generic column for use by sync adapters.

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/net/Uri` | `https://developer.android.com/reference/android/provider/CalendarContract.Calendars#CONTENT_URI` The content:// style URL for accessing Calendars |
| ` public static final https://developer.android.com/reference/android/net/Uri` | `https://developer.android.com/reference/android/provider/CalendarContract.Calendars#ENTERPRISE_CONTENT_URI` The content:// style URL for querying Calendars table in the managed profile. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Constants

### CALENDAR_LOCATION

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String CALENDAR_LOCATION
```

The default location for the calendar. Column name.

Type: TEXT

<br />

<br />

Constant Value: "calendar_location"

### DEFAULT_SORT_ORDER

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String DEFAULT_SORT_ORDER
```

The default sort order for this table

<br />

Constant Value: "calendar_displayName"

### NAME

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String NAME
```

The name of the calendar. Column name.

Type: TEXT

<br />

<br />

Constant Value: "name"

## Fields

### CONTENT_URI

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Uri CONTENT_URI
```

The content:// style URL for accessing Calendars

<br />

### ENTERPRISE_CONTENT_URI

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Uri ENTERPRISE_CONTENT_URI
```

The content:// style URL for querying Calendars table in the managed profile. Appending a calendar id using `https://developer.android.com/reference/android/content/ContentUris#withAppendedId(android.net.Uri,%20long)` specifies a single calendar.

The following columns are allowed to be queried via this uri:

- `https://developer.android.com/reference/android/provider/BaseColumns#_ID`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CALENDAR_COLOR`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#VISIBLE`
- `https://developer.android.com/reference/android/provider/CalendarContract.Calendars#CALENDAR_LOCATION`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#CALENDAR_TIME_ZONE`
- `https://developer.android.com/reference/android/provider/CalendarContract.CalendarColumns#IS_PRIMARY`

`https://developer.android.com/reference/java/lang/IllegalArgumentException` is thrown if there exists columns in the projection of the query to this uri that are not contained in the above list.

This uri returns an empty cursor if the calling user is not a parent profile of a managed profile, or the managed profile is disabled, or cross-profile calendar is disabled in Settings, or this uri is queried from a package that is not allowed by the profile owner of the managed profile via `https://developer.android.com/reference/android/app/admin/DevicePolicyManager#setCrossProfileCalendarPackages(android.content.ComponentName,%20java.util.Set<java.lang.String>)`.

Apps can register a `https://developer.android.com/reference/android/database/ContentObserver` for this URI to listen to changes.

<br />

**See also:**

- `https://developer.android.com/reference/android/app/admin/DevicePolicyManager#getCrossProfileCalendarPackages(android.content.ComponentName)`