{"id":16351794,"url":"https://github.com/jfversluis/plugin.maui.calendarstore","last_synced_at":"2025-07-28T16:31:37.471Z","repository":{"id":190393497,"uuid":"681559529","full_name":"jfversluis/Plugin.Maui.CalendarStore","owner":"jfversluis","description":"Plugin.Maui.CalendarStore provides the ability to access the device calendar information in your .NET MAUI application.","archived":false,"fork":false,"pushed_at":"2023-12-21T13:51:05.000Z","size":8671,"stargazers_count":69,"open_issues_count":11,"forks_count":10,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-01T15:42:07.623Z","etag":null,"topics":["android","calendar","dotnet","dotnet-maui","hacktoberfest","ios","macos","maui","windows"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jfversluis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"jfversluis"}},"created_at":"2023-08-22T09:20:30.000Z","updated_at":"2024-04-20T20:22:33.000Z","dependencies_parsed_at":"2024-10-11T01:24:07.073Z","dependency_job_id":"75e69046-5824-4c7e-9614-31505c25bcf9","html_url":"https://github.com/jfversluis/Plugin.Maui.CalendarStore","commit_stats":null,"previous_names":["jfversluis/plugin.maui.calendarstore","jfversluis/plugin.maui.calendar"],"tags_count":13,"template":false,"template_full_name":"jfversluis/Plugin.Maui.Feature","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfversluis%2FPlugin.Maui.CalendarStore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfversluis%2FPlugin.Maui.CalendarStore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfversluis%2FPlugin.Maui.CalendarStore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfversluis%2FPlugin.Maui.CalendarStore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jfversluis","download_url":"https://codeload.github.com/jfversluis/Plugin.Maui.CalendarStore/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227511027,"owners_count":17782618,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","calendar","dotnet","dotnet-maui","hacktoberfest","ios","macos","maui","windows"],"created_at":"2024-10-11T01:24:04.118Z","updated_at":"2025-07-28T16:31:37.463Z","avatar_url":"https://github.com/jfversluis.png","language":"C#","funding_links":["https://github.com/sponsors/jfversluis"],"categories":[],"sub_categories":[],"readme":"![](nuget.png)\n\n# Plugin.Maui.CalendarStore\n\n`Plugin.Maui.CalendarStore` provides the ability to access the device calendar information in your .NET MAUI application.\n\n## Install Plugin\n\n[![NuGet](https://img.shields.io/nuget/v/Plugin.Maui.CalendarStore.svg?label=NuGet)](https://www.nuget.org/packages/Plugin.Maui.CalendarStore/)\n\nAvailable on [NuGet](http://www.nuget.org/packages/Plugin.Maui.CalendarStore).\n\nInstall with the dotnet CLI: `dotnet add package Plugin.Maui.CalendarStore`, or through the NuGet Package Manager in Visual Studio.\n\n## API Usage\n\n`Plugin.Maui.CalendarStore` provides the `CalendarStore` class that has methods to retrieve calendars, events and attendee information from the device's calendar store.\n\nYou can either use it as a static class, e.g.: `CalendarStore.Default.GetCalendars()` or with dependency injection: `builder.Services.AddSingleton\u003cICalendarStore\u003e(CalendarStore.Default);`\n\n### Permissions\n\nBefore you can start using `CalendarStore`, you will need to request the proper permissions on each platform.\n\nThe runtime permission is automatically requested by the plugin when any of the methods is called.\n\n#### iOS/macOS\n\nFor more information, please refer to the [official Apple documentation](https://developer.apple.com/documentation/eventkit/accessing_the_event_store#2975207).\n\n##### iOS 17+\n\nAs of iOS 17, Apple has introduced a new layer of security for accessing calendar data. There is now a difference between only writing data to a calendar and obtain full access to calendar data. To use these, add the following keys to your `info.plist` file. When declared, the permission will be requested automatically at runtime.\n\n```xml\n\u003ckey\u003eNSCalendarsWriteOnlyAccessUsageDescription\u003c/key\u003e\n\u003cstring\u003eThis app needs your permission to write events to your calendars. This includes creating events, but not reading, modifying or deleting events.\u003c/string\u003e\n\n\u003ckey\u003eNSCalendarsFullAccessUsageDescription\u003c/key\u003e\n\u003cstring\u003eThis app needs your permission to fully manage events on your calendars. This includes reading, writing, modifying and deleting events.\u003c/string\u003e\n```\n\nRemember, you always want to declare the least amount of permissions that are needed for your app. Else this might look suspicious to your users when you have something declared, but you're not using it. That means: leave out any key from above that is not applicable to your situation.\n\nAdditionally, make sure that the descriptions you provide are useful and describe why you want to access this data. Failing to do so might result in your app being rejected from the App Store.\n\nIf you also still want to support older iOS versions (prior to version 17), also follow the instructions below.\n\nFor a sandboxed macOS application, additionally you will have to add an entry to the `Entitlements.plist`, you will need to add the `com.apple.security.personal-information.calendar` key with a value of `true`.\n\nSee an example of a complete `Entitlements.plist` file below.\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"\u003e\n\u003cplist version=\"1.0\"\u003e\n\u003cdict\u003e\n    \u003ckey\u003ecom.apple.security.app-sandbox\u003c/key\u003e\n    \u003ctrue/\u003e\n    \u003ckey\u003ecom.apple.security.personal-information.calendars\u003c/key\u003e\n    \u003ctrue/\u003e\n\u003c/dict\u003e\n\u003c/plist\u003e\n```\n\n##### iOS \u003c 17\n\nOn iOS and macOS prior to iOS 17, add the `NSCalendarsUsageDescription` key to your `info.plist` file. When declared, the permission will be requested automatically at runtime.\n\n```xml\n\u003ckey\u003eNSCalendarsUsageDescription\u003c/key\u003e\n\u003cstring\u003eThis app wants to access your calendars\u003c/string\u003e\n```\n\nIf your app supports older iOS versions than iOS 17, include this key as well as the ones described above.\n\n#### Android\n\nOn Android declare the `READ_CALENDAR` permission in your `AndroidManifest.xml` file for reading calendar information. If you also want to write information, also add the `WRITE_CALENDAR` permission.\n\nThis should be placed in the `manifest` node. You can also add this through the visual editor in Visual Studio.\n\nThe runtime permission is automatically requested by the plugin when any of the methods is called.\n\n```xml\n\u003cuses-permission android:name=\"android.permission.READ_CALENDAR\" /\u003e\n\u003cuses-permission android:name=\"android.permission.WRITE_CALENDAR\" /\u003e\n```\n\n#### Windows\n\nOn Windows declare the `Appointments` permission in your `Package.appxmanifest` file.\n\nThis should be places in the `\u003cCapabilities\u003e` node, that is under the `\u003cPackage\u003e` node.\n\nThe runtime permission is automatically requested by the plugin when any of the methods is called.\n\n```xml\n\u003cuap:Capability Name=\"appointments\"/\u003e\n`````\n\n### Dependency Injection\n\nYou will first need to register the `Calendars` with the `MauiAppBuilder` following the same pattern that the .NET MAUI Essentials libraries follow.\n\n```csharp\nbuilder.Services.AddSingleton(CalendarStore.Default);\n```\n\nYou can then enable your classes to depend on `ICalendarStore` as per the following example.\n\n```csharp\npublic class CalendarsViewModel\n{\n    readonly ICalendarStore calendarStore;\n\n    public CalendarsViewModel(ICalendarStore calendarStore)\n    {\n        this.calendarStore = calendarStore;\n    }\n\n    public async Task ReadCalendars()\n    {\n        var calendars = await calendarStore.GetCalendars();\n\n        foreach (var c in calendars)\n        {\n            Console.WriteLine(c.Name);\n        }\n    }\n}\n```\n\n### Straight usage\n\nAlternatively if you want to skip using the dependency injection approach you can use the `Calendars.Default` property.\n\n```csharp\npublic class CalendarsViewModel\n{\n    public async Task ReadCalendars()\n    {\n        var calendars = await CalendarStore.Default.GetCalendars();\n\n        foreach (var c in calendars)\n        {\n            Console.WriteLine(c.Name);\n        }\n    }\n}\n```\n\n### CalendarStore\n\nOnce you have created a `CalendarStore` instance you can interact with it in the following ways:\n\n#### Methods\n\n##### `IEnumerable\u003cCalendars\u003e GetCalendars()`\n\nRetrieves all available calendars from the device.\n\n##### `Calendar GetCalendar(string calendarId)`\n\nRetrieves a specific calendar from the device.\n\n##### `string CreateCalendar(string name, Color? color = null)`\n\nCreates a new calendar on the device with the specified name and optionally color.\nReturns the ID of the newly created calendar.\n\n##### `UpdateCalendar(string calendarId, string newName, Color? newColor = null)`\n\nUpdates the calendar, specified by the unique identifier, with the given values.\n\n\u003c!--##### `DeleteCalendar(string calendarId)`\n\nRemoves a calendar, specified by the unique identifier, from the device.\n\n##### `DeleteCalendar(Calendar calendarToDelete)`\n\nRemoves a calendar from the device.\nThis is basically just a convenience method that calls `DeleteCalendar` with `calendarToDelete.Id`.--\u003e\n\n##### `IEnumerable\u003cCalendarEvent\u003e GetEvents(string? calendarId = null, DateTimeOffset? startDate = null, DateTimeOffset? endDate = null)`\n\nRetrieves events from a specific calendar or all calendars from the device.\n\n##### `CalendarEvent GetEvent(string eventId)`\n\nRetrieves a specific event from the calendar store on the device.\n\n##### `string CreateEvent(string calendarId, string title, string description, string location, DateTimeOffset startDateTime, DateTimeOffset endDateTime, bool isAllDay = false)`\n\nCreates an event in the specified calendar with the provided information. Returns the ID of the newly created event.\n\n##### `string CreateEvent(CalendarEvent calendarEvent)`\n\nCreates an event based on the information in the `CalendarEvent` object. This is basically just a convenience method that calls `CreateEvent` with all the unpacked information from `calendarEvent`.\nReturns the ID of the newly created event.\n\n##### `string CreateAllDayEvent(string calendarId, string title, string description, string location, DateTimeOffset startDate, DateTimeOffset endDate)`\n\nCreates an all-day event in the specified calendar with the provided information. This is basically just a convenience method that calls `CreateEvent` with `isAllDay` set to true.\nReturns the ID of the newly created event.\n\n##### `UpdateEvent(string eventId, string title, string description, string location, DateTimeOffset startDateTime, DateTimeOffset endDateTime, bool isAllDay)`\n\nUpdates an event, specified by the unique identifier, on the device calendar.\n\n##### `UpdateEvent(CalendarEvent eventToUpdate)`\n\nUpdates an event on the device calendar.\nThis is basically just a convenience method that calls `UpdateEvent` with all the details provided from `eventToUpdate`.\n\n##### `DeleteEvent(string eventId)`\n\nRemoves an event, specified by the unique identifier, from the device calendar.\n\n##### `DeleteEvent(CalendarEvent eventToDelete)`\n\nRemoves an event from the device calendar.\nThis is basically just a convenience method that calls `DeleteEvent` with `eventToDelete.Id`.\n\n# Acknowledgements\n\nThis project could not have came to be without these projects and people, thank you! \u003c3\n\n## Xamarin.Essentials PR\n\nThere are a couple of people involved in bringing this functionality to Xamarin.Essentials. Unfortunately the [PR](https://github.com/xamarin/Essentials/pull/1384) was never merged. In an attempt not to let this code go to waste, I transformed it into this library. Thank you [@mattleibow](https://github.com/mattleibow), [@nickrandolph](https://github.com/nickrandolph), [@ScottBTR](https://github.com/ScottBTR) and [@mkieres](https://github.com/mkieres) for the initial work here!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfversluis%2Fplugin.maui.calendarstore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjfversluis%2Fplugin.maui.calendarstore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfversluis%2Fplugin.maui.calendarstore/lists"}