private async Task DeleteAppointment(IAppointmentItemWrapper item, Dictionary <AppointmentId, IEntityRelationData <AppointmentId, DateTime, WebResourceName, string> > relations)
        {
            IEntityRelationData <AppointmentId, DateTime, WebResourceName, string> relation;
            var appointmentId = new AppointmentId(item.Inner.EntryID, item.Inner.GlobalAppointmentID);

            if (relations.TryGetValue(appointmentId, out relation))
            {
                await _btypeRepository.TryDelete(relation.BtypeId, relation.BtypeVersion, NullEventSynchronizationContext.Instance);

                relations.Remove(appointmentId);
            }
            item.Inner.Delete();
        }
        async Task <IAppointmentItemWrapper> GetOrNull(AppointmentId id)
        {
            try
            {
                var itemById =
                    await _outlookRepository.Get(
                        new[] { id },
                        NullLoadEntityLogger.Instance,
                        NullEventSynchronizationContext.Instance);

                return(itemById.FirstOrDefault()?.Entity);
            }
            catch (COMException x) when(x.HResult == unchecked ((int)0x8004010F))
            {
                return(null);
            }
        }
        private void SwitchEventCategories(ChangedOptions changedOption, string oldCategory, string newCategory, AppointmentId eventId)
        {
            using (var eventWrapper = new AppointmentItemWrapper(
                       (AppointmentItem)_session.GetItemFromID(eventId.EntryId, changedOption.New.OutlookFolderStoreId),
                       entryId => (AppointmentItem)_session.GetItemFromID(entryId, changedOption.New.OutlookFolderStoreId)))
            {
                var categories = eventWrapper.Inner.Categories
                                 .Split(new[] { CultureInfo.CurrentCulture.TextInfo.ListSeparator }, StringSplitOptions.RemoveEmptyEntries)
                                 .Select(c => c.Trim());

                eventWrapper.Inner.Categories = string.Join(
                    CultureInfo.CurrentCulture.TextInfo.ListSeparator,
                    categories
                    .Except(new[] { oldCategory })
                    .Concat(new[] { newCategory })
                    .Distinct());

                eventWrapper.Inner.Save();
            }
        }
Exemple #4
0
 public void AnnounceAppointmentDeleted(AppointmentId id)
 {
 }
 public void AnnounceAppointmentDeleted(AppointmentId id)
 {
     _hashesById.Remove(id);
 }