Closed Raghava56 closed 6 years ago
@Raghava56 I don't understand your question/issue. Could you share your code? Why are you trying to set ExternalID
? It is readonly by design.
Hi @TheAlmightyBob, Thanks for your response. In CalendersImplementation Class GetEventAsync method getting this error can you check below method having this line (ExternalID = cursor.GetString(CalendarContract.Instances.EventId))
` public async Task<IList
if (deviceCalendar == null)
{
throw new ArgumentException("Specified calendar not found on device");
}
var eventsUriBuilder = CalendarContract.Instances.ContentUri.BuildUpon();
// Note that this is slightly different from the GetEventById projection
// due to the Instances API vs. Event API (specifically, IDs and start/end times)
//
string[] eventsProjection =
{
CalendarContract.Events.InterfaceConsts.Title,
CalendarContract.Events.InterfaceConsts.Description,
CalendarContract.Instances.Begin,
CalendarContract.Instances.End,
CalendarContract.Events.InterfaceConsts.AllDay,
CalendarContract.Events.InterfaceConsts.EventLocation,
CalendarContract.Instances.EventId
};
ContentUris.AppendId(eventsUriBuilder, DateConversions.GetDateAsAndroidMS(start));
ContentUris.AppendId(eventsUriBuilder, DateConversions.GetDateAsAndroidMS(end));
var eventsUri = eventsUriBuilder.Build();
return await Task.Run(() =>
{
var cursor = Query(eventsUri, eventsProjection,
string.Format("{0} = {1}", CalendarContract.Events.InterfaceConsts.CalendarId, calendar.ExternalID),
null, CalendarContract.Events.InterfaceConsts.Dtstart + " ASC");
var events = IterateCursor(cursor, () =>
{
bool allDay = cursor.GetBoolean(CalendarContract.Events.InterfaceConsts.AllDay);
var calendarEvent = new CalendarEvent
{
Name = cursor.GetString(CalendarContract.Events.InterfaceConsts.Title),
ExternalID = cursor.GetString(CalendarContract.Instances.EventId),
Description = cursor.GetString(CalendarContract.Events.InterfaceConsts.Description),
Start = cursor.GetDateTime(CalendarContract.Instances.Begin, allDay),
End = cursor.GetDateTime(CalendarContract.Instances.End, allDay),
Location = cursor.GetString(CalendarContract.Events.InterfaceConsts.EventLocation),
AllDay = allDay
};
calendarEvent.Reminders = GetEventReminders(calendarEvent.ExternalID);
return calendarEvent;
});
return events;
}).ConfigureAwait(false);
}`
Hi @TheAlmightyBob, Property looks like public string ExternalID { get; internal set; } in github in calender class . But in the Package, Property is public string ExternalID { get; } like this.
Due to above reason only getting error.
Thanks & Regards, Raghava
That is just because the setter is internal
, so the IDE isn't showing it to you because you don't have access to it. If you were to use a decompiler on the package you'd see the internal set
is still there.
The platform implementation is within the internal
scope however so does have access.
Maybe take a look at https://github.com/TheAlmightyBob/CalendarsTester ?
That's using the same NuGet package and doesn't have this error.
Thanks @TheAlmightyBob
Hi @TheAlmightyBob,
i installed this package after integrating the code this issue came in GetEventAsync Method. in this ExternalID = cursor.GetString(CalendarContract.Instances.EventId);.
Some more properties are there like this. Please can you update the nuget package.
Thanks & Regards