public void CopyOrMoveAppointment() { ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "CalendarViewEventHandler.CrossCalendarCopyMove"); OwaStoreObjectId owaStoreObjectId = (OwaStoreObjectId)base.GetParameter("Id"); string changeKey = (string)base.GetParameter("CK"); OwaStoreObjectId owaStoreObjectId2 = (OwaStoreObjectId)base.GetParameter("fId"); bool flag = (bool)base.GetParameter("fC"); StoreObjectId storeObjectId = owaStoreObjectId2.StoreObjectId; CalendarItemBase calendarItemBase = null; if (Utilities.IsELCRootFolder(owaStoreObjectId2, base.UserContext)) { throw new OwaInvalidRequestException("Cannot move messages to the root ELC folder."); } if (owaStoreObjectId.IsGSCalendar) { throw new OwaInvalidRequestException("Item id cannot be GS Calendar folder id"); } if (owaStoreObjectId2.IsGSCalendar) { throw new OwaInvalidRequestException("Cannot copy/move to GS Calendar"); } MailboxSession mailboxSession = owaStoreObjectId2.GetSessionForFolderContent(base.UserContext) as MailboxSession; if (mailboxSession == null) { throw new OwaInvalidRequestException("Cannot copy/move to public folder by this function"); } if (storeObjectId.ObjectType != StoreObjectType.CalendarFolder) { throw new OwaInvalidRequestException("This function only support to copy/move to calendar folder"); } try { calendarItemBase = Utilities.GetItem <CalendarItemBase>(base.UserContext, owaStoreObjectId, changeKey, new PropertyDefinition[] { StoreObjectSchema.EffectiveRights }); if (calendarItemBase.ParentId.Equals(storeObjectId)) { this.RenderCopyMoveFail(-612884101); } else { MailboxSession mailboxSession2 = calendarItemBase.Session as MailboxSession; if (mailboxSession2 == null) { throw new OwaInvalidRequestException("Cannot copy/move from public folder by this function"); } if (!StringComparer.OrdinalIgnoreCase.Equals(mailboxSession2.MailboxOwner.LegacyDn, mailboxSession.MailboxOwner.LegacyDn)) { if (flag) { this.RenderCopyMoveFail(-1539006262); } else { this.RenderCopyMoveFail(1992576846); } } else { bool flag2 = Utilities.CanCreateItemInFolder(base.UserContext, owaStoreObjectId2) && !Utilities.IsExternalSharedInFolder(base.UserContext, owaStoreObjectId2); if (!flag) { flag2 = (flag2 && CalendarUtilities.UserCanDeleteCalendarItem(calendarItemBase) && !Utilities.IsItemInExternalSharedInFolder(base.UserContext, calendarItemBase)); } if (!flag2) { ExTraceGlobals.CalendarTracer.TraceDebug(0L, "User have no rights to remove item from source folder or create new item in target folder."); this.Writer.Write("<div id=divOp _sOp=\"np\"></div>"); } else { if (flag) { calendarItemBase.CopyToFolder(mailboxSession, storeObjectId); } else { calendarItemBase.MoveToFolder(mailboxSession, storeObjectId); } this.Writer.Write("<div id=divOp _sOp=\"rf\"></div>"); TargetFolderMRU.AddAndGetFolders(owaStoreObjectId2, base.UserContext); } } } } catch (CalendarItemExistsException) { this.RenderCopyMoveFail(-95861205); } catch (FutureMeetingException) { this.RenderCopyMoveFail(((bool)base.GetParameter("rcr")) ? 225743507 : -989731968); } catch (PrimaryCalendarFolderException) { this.RenderCopyMoveFail(-812685732); } catch (ObjectNotFoundException) { ExTraceGlobals.CalendarDataTracer.TraceDebug((long)this.GetHashCode(), "Calendar item could not be found"); throw; } finally { if (calendarItemBase != null) { calendarItemBase.Dispose(); calendarItemBase = null; } } }