Beispiel #1
0
        public void ChangeEndRecurrence()
        {
            OwaStoreObjectId owaStoreObjectId = (OwaStoreObjectId)base.GetParameter("Id");
            string           changeKey        = (string)base.GetParameter("CK");
            ExDateTime       endRange         = (ExDateTime)base.GetParameter("ET");
            CalendarItem     calendarItem     = null;

            try
            {
                calendarItem = Utilities.GetItem <CalendarItem>(base.UserContext, owaStoreObjectId, changeKey, new PropertyDefinition[]
                {
                    CalendarItemBaseSchema.IsMeeting,
                    CalendarItemBaseSchema.MeetingRequestWasSent,
                    StoreObjectSchema.EffectiveRights
                });
                if (!ItemUtility.UserCanEditItem(calendarItem) || Utilities.IsItemInExternalSharedInFolder(base.UserContext, calendarItem))
                {
                    this.Writer.Write("<div id=divOp _sOp=\"np\"></div>");
                }
                else
                {
                    int num = MeetingUtilities.CancelRecurrence(calendarItem, endRange);
                    if (num != -2147483648)
                    {
                        if (calendarItem.IsMeeting && calendarItem.MeetingRequestWasSent && calendarItem.IsOrganizer())
                        {
                            base.ResponseContentType = OwaEventContentType.Html;
                            this.Writer.Write("<div id=divOp _sOp=er></div>");
                        }
                        else if (0 < num)
                        {
                            EndDateRecurrenceRange range = new EndDateRecurrenceRange(calendarItem.Recurrence.Range.StartDate, endRange.IncrementDays(-1));
                            calendarItem.Recurrence = new Recurrence(calendarItem.Recurrence.Pattern, range);
                            Utilities.SaveItem(calendarItem);
                            this.RenderPayload(new OwaStoreObjectId[]
                            {
                                (OwaStoreObjectId)base.GetParameter("fId")
                            });
                        }
                        else
                        {
                            calendarItem.DeleteMeeting(DeleteItemFlags.MoveToDeletedItems);
                            this.RenderPayload(new OwaStoreObjectId[]
                            {
                                (OwaStoreObjectId)base.GetParameter("fId")
                            });
                        }
                    }
                }
            }
            finally
            {
                if (calendarItem != null)
                {
                    calendarItem.Dispose();
                    calendarItem = null;
                }
            }
        }