Exemple #1
0
        /// <summary>
        /// Gets a single calendar event by platform-specific ID.
        /// </summary>
        /// <param name="externalId">Platform-specific calendar event identifier</param>
        /// <returns>The corresponding calendar event, or null if not found</returns>
        /// <exception cref="System.UnauthorizedAccessException">Calendar access denied</exception>
        /// <exception cref="Calendars.Plugin.Abstractions.PlatformException">Unexpected platform-specific error</exception>
        public async Task <CalendarEvent> GetEventByIdAsync(string externalId)
        {
            if (string.IsNullOrWhiteSpace(externalId))
            {
                return(null);
            }

            await RequestCalendarAccess().ConfigureAwait(false);

            var iosEvent = _eventStore.EventFromIdentifier(externalId);

            return(iosEvent == null ? null : iosEvent.ToCalendarEvent());
        }