Beispiel #1
0
        public void ExecuteOnInstance(Event seriesInstance)
        {
            base.Parameters.MeetingRequestIdToBeDeleted = null;
            Event @event = new Event
            {
                Id        = seriesInstance.Id,
                ChangeKey = seriesInstance.ChangeKey
            };
            IActionPropagationState actionPropagationState = @event;

            actionPropagationState.LastExecutedAction = new Guid?(this.CommandId);
            IEventInternal eventInternal = @event;

            eventInternal.SeriesToInstancePropagation = true;
            RespondToEvent respondToEvent = new RespondToEvent
            {
                EntityKey     = @event.Id,
                UpdateToEvent = @event,
                Parameters    = base.Parameters,
                Scope         = this.Scope
            };

            respondToEvent.Execute(new CommandContext
            {
                IfMatchETag = seriesInstance.ChangeKey
            });
            if (base.Parameters.Response != ResponseType.Declined)
            {
                Event event2 = this.Scope.Read(base.EntityKey, null);
                seriesInstance.ChangeKey = event2.ChangeKey;
            }
        }
Beispiel #2
0
        private Event GetBasicEventData(IStorePropertyBag propertyBag)
        {
            Event basicSeriesEventData = EventExtensions.GetBasicSeriesEventData(propertyBag, this.Scope);

            byte[] valueOrDefault = propertyBag.GetValueOrDefault <byte[]>(CalendarItemBaseSchema.GlobalObjectId, null);
            if (valueOrDefault != null)
            {
                IEventInternal eventInternal = basicSeriesEventData;
                eventInternal.GlobalObjectId = new GlobalObjectId(valueOrDefault).ToString();
            }
            return(basicSeriesEventData);
        }
Beispiel #3
0
        protected override VoidResult OnExecute()
        {
            Event          initialMasterValue = this.GetInitialMasterValue();
            IEventInternal eventInternal      = initialMasterValue;
            IEventInternal eventInternal2     = this.Scope.Read(initialMasterValue.Id, this.Context);

            eventInternal.SeriesSequenceNumber = eventInternal2.SeriesSequenceNumber + 1;
            this.seriesSequenceNumber          = eventInternal.SeriesSequenceNumber;
            this.masterGoid        = ((eventInternal2.GlobalObjectId != null) ? new GlobalObjectId(eventInternal2.GlobalObjectId).Bytes : null);
            this.seriesPropagation = this.CreateInteropPropagationCommand(null);
            this.seriesPropagation.Execute(null);
            return(VoidResult.Value);
        }
Beispiel #4
0
        protected override Event OnExecute()
        {
            Event initialMasterValue = this.GetInitialMasterValue();
            Event @event             = this.Scope.Read(initialMasterValue.Id, this.Context);

            base.MergeAttendeesList(@event.Attendees);
            IEventInternal eventInternal  = initialMasterValue;
            IEventInternal eventInternal2 = @event;

            eventInternal.SeriesSequenceNumber = eventInternal2.SeriesSequenceNumber + 1;
            this.seriesSequenceNumber          = eventInternal.SeriesSequenceNumber;
            this.masterGoid        = ((eventInternal2.GlobalObjectId != null) ? new GlobalObjectId(eventInternal2.GlobalObjectId).Bytes : null);
            this.seriesPropagation = this.CreateInteropPropagationCommand(null);
            return(this.seriesPropagation.Execute(null));
        }
        private Event GetOccurrenceWithViewProperties(IStorePropertyBag propertyBag)
        {
            Event basicSeriesEventData = EventExtensions.GetBasicSeriesEventData(propertyBag, base.Scope);

            basicSeriesEventData.Start    = propertyBag.GetValueOrDefault <ExDateTime>(CalendarItemInstanceSchema.StartTime, ExDateTime.MinValue);
            basicSeriesEventData.End      = propertyBag.GetValueOrDefault <ExDateTime>(CalendarItemInstanceSchema.EndTime, ExDateTime.MaxValue);
            basicSeriesEventData.Subject  = propertyBag.GetValueOrDefault <string>(ItemSchema.Subject, string.Empty);
            basicSeriesEventData.Location = new Location
            {
                DisplayName = propertyBag.GetValueOrDefault <string>(CalendarItemBaseSchema.Location, string.Empty)
            };
            basicSeriesEventData.Sensitivity = default(SensitivityConverter).StorageToEntitiesConverter.Convert(propertyBag.GetValueOrDefault <Microsoft.Exchange.Data.Storage.Sensitivity>(ItemSchema.Sensitivity, Microsoft.Exchange.Data.Storage.Sensitivity.Normal));
            basicSeriesEventData.IsAllDay    = propertyBag.GetValueOrDefault <bool>(CalendarItemBaseSchema.IsAllDayEvent, false);
            IEventInternal eventInternal = basicSeriesEventData;

            eventInternal.GlobalObjectId = new GlobalObjectId(propertyBag.GetValueOrDefault <byte[]>(CalendarItemBaseSchema.GlobalObjectId, null)).ToString();
            return(basicSeriesEventData);
        }
        private Event GetBasicEventDataForRetry(IStorePropertyBag propertyBag)
        {
            Event  basicSeriesEventData = EventExtensions.GetBasicSeriesEventData(propertyBag, this.Scope);
            string valueOrDefault       = propertyBag.GetValueOrDefault <string>(CalendarItemBaseSchema.EventClientId, null);
            int    valueOrDefault2      = propertyBag.GetValueOrDefault <int>(CalendarItemSchema.InstanceCreationIndex, -1);
            int    valueOrDefault3      = propertyBag.GetValueOrDefault <int>(CalendarItemSeriesSchema.SeriesCreationHash, -1);

            basicSeriesEventData.ClientId = valueOrDefault;
            IEventInternal eventInternal = basicSeriesEventData;

            if (valueOrDefault2 != -1)
            {
                eventInternal.InstanceCreationIndex = valueOrDefault2;
            }
            if (valueOrDefault3 != -1)
            {
                eventInternal.SeriesCreationHash = valueOrDefault3;
            }
            return(basicSeriesEventData);
        }
        internal static void DeleteRelatedMessage(this IEventInternal entity, string messageId, DeleteItemFlags flags, IXSOFactory xsoFactory, IdConverter idConverter, IStoreSession session, bool markAsReadBeforeDelete)
        {
            StoreObjectId storeObjectId = idConverter.ToStoreObjectId(messageId);

            using (IMeetingMessage meetingMessage = xsoFactory.BindToMeetingMessage(session, storeObjectId))
            {
                if (meetingMessage == null || meetingMessage.GlobalObjectId == null || meetingMessage.GlobalObjectId.ToString() != entity.GlobalObjectId)
                {
                    throw new InvalidRequestException(CalendaringStrings.ErrorMeetingMessageNotFoundOrCantBeUsed);
                }
                if (markAsReadBeforeDelete)
                {
                    meetingMessage.OpenAsReadWrite();
                    meetingMessage.IsRead = true;
                    meetingMessage.Save(SaveMode.NoConflictResolutionForceSave);
                }
            }
            session.Delete(flags, new StoreId[]
            {
                storeObjectId
            });
        }
        public override Event ConvertToEntity(ICalendarItemBase master, ICalendarItemBase instance)
        {
            Event @event = EventTranslator.Instance.ConvertToEntity(master);
            Event event2 = EventTranslator.Instance.ConvertToEntity(instance);

            @event.SeriesMasterId        = @event.Id;
            @event.ChangeKey             = event2.ChangeKey;
            @event.End                   = event2.End;
            @event.Id                    = event2.Id;
            @event.StoreId               = event2.StoreId;
            @event.PopupReminderSettings = event2.PopupReminderSettings;
            @event.Start                 = event2.Start;
            @event.Type                  = event2.Type;
            IEventInternal eventInternal  = @event;
            IEventInternal eventInternal2 = event2;

            eventInternal.GlobalObjectId        = eventInternal2.GlobalObjectId;
            eventInternal.InstanceCreationIndex = eventInternal2.InstanceCreationIndex;
            IActionPropagationState actionPropagationState  = @event;
            IActionPropagationState actionPropagationState2 = event2;

            actionPropagationState.LastExecutedAction = actionPropagationState2.LastExecutedAction;
            PropertyChangeMetadata propertyChangeMetadata;

            if (CalendarItemAccessors.PropertyChangeMetadata.TryGetValue(instance, out propertyChangeMetadata))
            {
                IEnumerable <PropertyChangeMetadata.PropertyGroup> overriddenGroups = propertyChangeMetadata.GetOverriddenGroups();
                foreach (ITranslationRule <ICalendarItemBase, Event> translationRule2 in from translationRule in base.Strategy.EnumerateRules <ICalendarItemBase, Event>()
                         let storageRule = translationRule as IStorageTranslationRule <ICalendarItemBase, Event>
                                           where storageRule != null && overriddenGroups.Contains(storageRule.StoragePropertyGroup)
                                           select translationRule)
                {
                    translationRule2.FromLeftToRightType(instance, @event);
                }
            }
            return(@event);
        }
 internal static async Task Post <T>(IEventInternal <T> @event) where T : class
 {
     await Task.WhenAll(GetHooks(@event).Select(hook => hook.Post(@event)));
 }
 private static IEnumerable <Webhook> GetHooks <T>(IEventInternal <T> @event) where T : class
 {
     return(Db.SQL <Webhook>(Webhook.ByEventName, @event.Name));
 }