示例#1
0
        public static async Task <bool> TryUpdateCalendarEventAsync()
        {
            var newEventId = await CalendarSnippets.AddCalendarEventWithArgsAsync(
                "OrigLocationValue",
                STORY_DATA_IDENTIFIER,
                string.Empty,
                Guid.NewGuid().ToString(),
                new DateTimeOffset(DateTime.Now),
                new DateTimeOffset(DateTime.Now),
                new TimeSpan(DateTime.Now.Ticks),
                new TimeSpan(DateTime.Now.Ticks)
                );

            if (newEventId == null)
            {
                return(false);
            }

            // Update our event
            var updatedEvent = await CalendarSnippets.UpdateCalendarEventAsync(newEventId,
                                                                               "NewLocationValue",
                                                                               STORY_DATA_IDENTIFIER,
                                                                               string.Empty,
                                                                               Guid.NewGuid().ToString(),
                                                                               new DateTimeOffset(DateTime.Now),
                                                                               new DateTimeOffset(DateTime.Now),
                                                                               new TimeSpan(DateTime.Now.Ticks),
                                                                               new TimeSpan(DateTime.Now.Ticks)
                                                                               );

            if (updatedEvent == null || updatedEvent.Id != newEventId)
            {
                return(false);
            }

            //Cleanup
            await CalendarSnippets.DeleteCalendarEventAsync(newEventId);


            return(true);
        }
示例#2
0
        public static async Task <bool> TryCreateCalendarEventWithArgsAsync()
        {
            var newEventId = await CalendarSnippets.AddCalendarEventWithArgsAsync(
                Guid.NewGuid().ToString(),
                STORY_DATA_IDENTIFIER,
                string.Empty,
                Guid.NewGuid().ToString(),
                new DateTimeOffset(DateTime.Now),
                new DateTimeOffset(DateTime.Now),
                new TimeSpan(DateTime.Now.Ticks),
                new TimeSpan(DateTime.Now.Ticks)
                );

            if (newEventId == null)
            {
                return(false);
            }

            //Cleanup
            await CalendarSnippets.DeleteCalendarEventAsync(newEventId);

            return(true);
        }