xamarin - Xamarin get all data (events, reminders ) from Calendar
问题描述
How to get all data present in my Calendar using Xamarin. I am using below code and It is only returning already present holidays list. I want to get the manually added events and reminder list also.Below is the code am using
var calendarsUri = CalendarContract.Events.ContentUri;
var cursor = Forms.Context.ContentResolver.Query(calendarsUri, null, null, null, null);
if (cursor.MoveToFirst())
{
do
{
calendarEventList.Add(new Calendar()
{
Id = cursor.GetString(cursor.GetColumnIndex(ContactsContract.Contacts.InterfaceConsts.Id)),
CalendarDisplayName = cursor.GetString(cursor.GetColumnIndex(CalendarContract.Calendars.InterfaceConsts.CalendarDisplayName)),
AccountName = cursor.GetString(cursor.GetColumnIndex(CalendarContract.Calendars.InterfaceConsts.AccountType)),
Title = cursor.GetString(cursor.GetColumnIndex(CalendarContract.Events.InterfaceConsts.Title)),
Description = cursor.GetString(cursor.GetColumnIndex(CalendarContract.Events.InterfaceConsts.Description)),
Dtstart = cursor.GetString(cursor.GetColumnIndex(CalendarContract.Events.InterfaceConsts.Dtstart)),
Dtend = cursor.GetString(cursor.GetColumnIndex(CalendarContract.Events.InterfaceConsts.Dtend))
});
} while (cursor.MoveToNext());
}
So my 'calendarEventList' contains only the holidays event. Can anyone help me with getting all the events from my Calendar.
Thank in Advance.
解决方案
推荐阅读
- javascript - 如何为 Intl.DateTimeFormat 设置全局选项
- python - 有没有办法将整个随机森林放入一个图中,而不是一对一的单个估计器?
- php - 查找单词是否存在于数组或字符串PHP中
- mongodb - mongos 从不同应用程序查询时返回空集合
- python - 如何在cygwin中运行的python中拦截ctrl + c命令
- android - 如何修复 Android/Webrtc/PeerConnection/createOffer 中的“m=video 9 UDP/TLS/RTP/SAVPF 0”问题
- git - Git 使用未知方法对我的 bitbucket 进行身份验证
- progressive-web-apps - PWA 添加到主屏幕无法按预期工作
- rest - 带有 x-www-form-urlencoded 消息类型服务调用的 WSO2 ESB
- android - 一个 Firebase 应用程序(一个 google_services.json)可以在两个不同包名的 Android 应用程序中使用吗