internal static List <MeetingData> GetCorrelatedMeetings(MailboxSession session, UserObject mailboxUser, StoreId meetingId) { List <MeetingData> list = new List <MeetingData>(); using (CalendarItemBase calendarItemBase = CalendarItemBase.Bind(session, meetingId, CalendarQuery.CalendarQueryProps)) { MeetingData item = MeetingData.CreateInstance(mailboxUser, calendarItemBase); list.Add(item); if (calendarItemBase.CalendarItemType == CalendarItemType.RecurringMaster) { try { IList <OccurrenceInfo> modifiedOccurrences = (calendarItemBase as CalendarItem).Recurrence.GetModifiedOccurrences(); foreach (OccurrenceInfo occurrenceInfo in modifiedOccurrences) { MeetingData item2 = MeetingData.CreateInstance(mailboxUser, occurrenceInfo.VersionedId, calendarItemBase.GlobalObjectId, CalendarItemType.Exception); list.Add(item2); } } catch (RecurrenceFormatException) { } } } return(list); }
public override CalendarItemBase TryGetCorrelatedItemFromHintId(MailboxSession session, StoreObjectId hintId) { if (hintId != null) { try { CalendarItemBase calendarItemBase = CalendarItemBase.Bind(session, hintId); if (!this.ValidateCorrelatedItem(calendarItemBase)) { calendarItemBase.Dispose(); throw new CorrelationFailedException(ServerStrings.ExCorrelationFailedForOccurrence(this.Subject)); } calendarItemBase.OpenAsReadWrite(); calendarItemBase.IsCorrelated = true; this.correlatedItemId = calendarItemBase.Id; calendarItemBase.AssociatedItemId = base.Id; this.externalCorrelatedCalendarItem = calendarItemBase; this.getCorrelatedItemCalled = true; return(calendarItemBase); } catch (Exception arg) { ExTraceGlobals.MeetingMessageTracer.TraceError <string, Exception>((long)this.GetHashCode(), "Exception thrown when trying to bind to calendar item id hint passed from meeting series message ordering agent. Mailbox = {0}, exception = {1}.", session.MailboxOwnerLegacyDN, arg); } } return(null); }
private Inconsistency GetAttendeeMissingItemInconsistency(CalendarValidationContext context, string fullDescription, ClientIntentQuery.QueryResult inconsistencyIntent, ClientIntentFlags declineIntent, ClientIntentFlags deleteIntent) { Inconsistency inconsistency = null; if (ClientIntentQuery.CheckDesiredClientIntent(inconsistencyIntent.Intent, new ClientIntentFlags[] { declineIntent })) { inconsistency = ResponseInconsistency.CreateInstance(fullDescription, ResponseType.Decline, context.Attendee.ResponseType, ExDateTime.MinValue, context.Attendee.ReplyTime, context); inconsistency.Intent = inconsistencyIntent.Intent; } else if (ClientIntentQuery.CheckDesiredClientIntent(inconsistencyIntent.Intent, new ClientIntentFlags[] { deleteIntent })) { inconsistency = null; } else if (inconsistencyIntent.SourceVersionId != null) { int?deletedItemVersion = null; using (CalendarItemBase calendarItemBase = CalendarItemBase.Bind(this.session, inconsistencyIntent.SourceVersionId)) { deletedItemVersion = calendarItemBase.GetValueAsNullable <int>(CalendarItemBaseSchema.ItemVersion); } if (deletedItemVersion != null) { inconsistency = MissingItemInconsistency.CreateAttendeeMissingItemInstance(fullDescription, inconsistencyIntent.Intent, deletedItemVersion, context); inconsistency.Intent = inconsistencyIntent.Intent; } } return(inconsistency); }
internal static CalendarItemBase FindMatchingItem(MailboxSession session, CalendarFolder calendarFolder, CalendarItemType itemType, byte[] globalId, ref string errorString) { VersionedId calendarItemId = calendarFolder.GetCalendarItemId(globalId); if (calendarItemId == null) { errorString = string.Format("FindMatchingItem: Could not find calendar item, itemId is null. ", new object[0]); return(null); } CalendarItemBase result; try { result = CalendarItemBase.Bind(session, calendarItemId, CalendarQuery.CalendarQueryProps); } catch (ObjectNotFoundException ex) { errorString = string.Format("[{0}(UTC)] FindMatchingItem: Could not find calendar item, exception = {1}. ", ExDateTime.UtcNow, ex.GetType()); result = null; } catch (ArgumentException ex2) { errorString = string.Format("[{0}(UTC)] FindMatchingItem: Could not bind to item as CalendarItemBase, exception = {1}. ", ExDateTime.UtcNow, ex2.GetType()); result = null; } return(result); }
private void SendCancellationBasedOnFoundIntent(VersionedId cancelledVersionId) { using (CalendarItemBase calendarItemBase = CalendarItemBase.Bind(base.Session, cancelledVersionId)) { IList <Attendee> rumAttendees = this.GetRumAttendees(calendarItemBase); CancellationRumInfo info; if (this.GlobalObjectId.IsCleanGlobalObjectId) { info = CancellationRumInfo.CreateMasterInstance(rumAttendees); } else { info = CancellationRumInfo.CreateOccurrenceInstance(this.GlobalObjectId.Date, rumAttendees); } Dictionary <GlobalObjectId, List <Attendee> > dictionary = new Dictionary <GlobalObjectId, List <Attendee> >(1); RumAgent.Instance.SendRums(info, false, calendarItemBase, ref dictionary); } }
private static bool WouldTryToRepairIfMissing(CalendarVersionStoreGateway cvsGateway, GlobalObjectId globalObjectId, MailboxSession session, MeetingInquiryMessage message, bool performRepair, byte[] calendarFolderId, out MeetingInquiryAction predictedAction) { VersionedId versionedId; bool result; if (MeetingInquiryMessage.TryGetCancelledVersionIdFromCvs(cvsGateway, globalObjectId, session, calendarFolderId, out versionedId)) { if (performRepair) { message.LocationIdentifierHelperInstance.SetLocationIdentifier(47383U, LastChangeAction.SendMeetingCancellations); message.SendCancellationBasedOnFoundIntent(versionedId); } predictedAction = MeetingInquiryAction.SendCancellation; result = true; } else { if (versionedId != null) { using (CalendarItemBase calendarItemBase = CalendarItemBase.Bind(session, versionedId)) { predictedAction = MeetingInquiryMessage.GetReviveAction(cvsGateway, session, calendarItemBase); if (predictedAction == MeetingInquiryAction.ReviveMeeting) { if (performRepair) { predictedAction = message.TryReviveMeeting(calendarItemBase); } result = true; } else { result = false; } return(result); } } ExTraceGlobals.MeetingMessageTracer.TraceDebug <string, GlobalObjectId>((long)session.GetHashCode(), "Storage.MeetingInquiryMessage::Process. Couldn't find deletion on mailbox {0}. Skipping GOID {1}", session.DisplayName, globalObjectId); predictedAction = MeetingInquiryAction.DeletedVersionNotFound; result = false; } return(result); }
public CalendarItemBase GetItem(StoreObjectId itemId, params PropertyDefinition[] dataColumns) { base.CheckDisposed("GetItem"); Util.ThrowOnNullArgument(itemId, "itemId"); if (this.DetailLevel == DetailLevelEnumType.AvailabilityOnly) { throw new InvalidOperationException(); } CalendarItemBase calendarItemBase = CalendarItemBase.Bind(base.MailboxSession, itemId, dataColumns); using (DisposeGuard disposeGuard = calendarItemBase.Guard()) { if (!calendarItemBase.ParentId.Equals(base.FolderId)) { throw new ObjectNotFoundException(ServerStrings.ExItemNotFound); } disposeGuard.Success(); } return(calendarItemBase); }
internal override CalendarItemBase GetCorrelatedItemInternal(bool cache, bool shouldDetectDuplicateIds, out IEnumerable <VersionedId> detectedDuplicatesIds) { ExTraceGlobals.MeetingMessageTracer.Information <GlobalObjectId, bool>((long)this.GetHashCode(), "Storage.MeetingMessage.GetCorrelatedItem: GOID={0}; cache={1}", this.GlobalObjectId, cache); if (!(base.Session is MailboxSession)) { detectedDuplicatesIds = null; return(null); } if (this.cachedCorrelatedItem != null) { if (!shouldDetectDuplicateIds) { ExTraceGlobals.MeetingMessageTracer.Information <GlobalObjectId>((long)this.GetHashCode(), "Storage.MeetingMessage.GetCorrelatedItemInternal: GOID={0}. Returning cached correlated item.", this.GlobalObjectId); CalendarItemBase result = this.cachedCorrelatedItem; if (!cache) { this.cachedCorrelatedItem.SetDisposeTrackerStacktraceToCurrentLocation(); this.cachedCorrelatedItem = null; } detectedDuplicatesIds = Array <VersionedId> .Empty; return(result); } ExTraceGlobals.MeetingMessageTracer.Information <GlobalObjectId>((long)this.GetHashCode(), "Storage.MeetingMessage.GetCorrelatedItemInternal: GOID={0}. Clearing cached item.", this.GlobalObjectId); this.cachedCorrelatedItem.Dispose(); this.cachedCorrelatedItem = null; } MailboxSession calendarMailboxSession; try { calendarMailboxSession = MeetingMessage.GetCalendarMailboxSession(this); } catch (NotSupportedWithServerVersionException ex) { ExTraceGlobals.MeetingMessageTracer.Information((long)this.GetHashCode(), "MeetingMessage::GetCorrelatedItemInternal. Calendar mailbox session failed to open due to not supported server version."); throw new CorrelationFailedException(ex.LocalizedString, ex); } catch (AdUserNotFoundException ex2) { ExTraceGlobals.MeetingMessageTracer.Information((long)this.GetHashCode(), "MeetingMessage::GetCorrelatedItemInternal. Calendar mailbox session failed to open due to not being able to find the owner's mailbox."); throw new CorrelationFailedException(ex2.LocalizedString, ex2); } StoreObjectId defaultFolderId = calendarMailboxSession.GetDefaultFolderId(DefaultFolderType.Calendar); if (defaultFolderId == null) { ExTraceGlobals.MeetingMessageTracer.Information((long)this.GetHashCode(), "MeetingMessage::GetCorrelatedItemInternal. Calendar folder is not found. We treat it as correlated calendar item has been deleted."); detectedDuplicatesIds = null; return(null); } CalendarItemBase calendarItemBase = null; bool flag = false; try { using (CalendarFolder calendarFolder = CalendarFolder.Bind(calendarMailboxSession, defaultFolderId)) { int i = 0; while (i < 2) { ExTraceGlobals.MeetingMessageTracer.Information <GlobalObjectId, int>((long)this.GetHashCode(), "Storage.MeetingMessage.GetCorrelatedItemInternal: GOID={0}. Retrying fetch count={1}", this.GlobalObjectId, i); this.FetchCorrelatedItemId(calendarFolder, shouldDetectDuplicateIds, out detectedDuplicatesIds); if (this.correlatedItemId != null) { try { calendarItemBase = CalendarItemBase.Bind(calendarMailboxSession, this.correlatedItemId.ObjectId); } catch (OccurrenceNotFoundException) { ExTraceGlobals.MeetingMessageTracer.Information <GlobalObjectId>((long)this.GetHashCode(), "Storage.MeetingMessage.GetCorrelatedItemInternal: GOID={0}. Occurrence not found.", this.GlobalObjectId); this.possibleDeletedOccurrenceId = this.correlatedItemId.ObjectId; this.correlatedItemId = null; break; } catch (ObjectNotFoundException) { ExTraceGlobals.MeetingMessageTracer.Information <GlobalObjectId>((long)this.GetHashCode(), "Storage.MeetingMessage.GetCorrelatedItemInternal: GOID={0}. Calendar item id was found but calendar item got deleted.", this.GlobalObjectId); this.correlatedItemId = null; goto IL_259; } catch (WrongObjectTypeException innerException) { throw new CorruptDataException(ServerStrings.ExNonCalendarItemReturned("Unknown"), innerException); } catch (ArgumentException) { throw new CorruptDataException(ServerStrings.ExNonCalendarItemReturned("Unknown")); } goto IL_20D; IL_259: i++; continue; IL_20D: calendarItemBase.OpenAsReadWrite(); if (base.Id != null) { calendarItemBase.AssociatedItemId = base.Id; } if (cache) { ExTraceGlobals.MeetingMessageTracer.Information <GlobalObjectId>((long)this.GetHashCode(), "Storage.MeetingMessage.GetCorrelatedItemInternal: GOID={0}. Caching correlated calendar item.", this.GlobalObjectId); this.cachedCorrelatedItem = calendarItemBase; } flag = true; return(calendarItemBase); } break; } } } finally { if (!flag) { Util.DisposeIfPresent(calendarItemBase); } } detectedDuplicatesIds = null; return(null); }
public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action) { if (owaContext == null) { throw new ArgumentNullException("owaContext"); } applicationElement = ApplicationElement.NotSet; type = string.Empty; state = string.Empty; action = string.Empty; PreFormActionResponse preFormActionResponse = new PreFormActionResponse(); preFormActionResponse.Type = owaContext.FormsRegistryContext.Type; preFormActionResponse.ApplicationElement = ApplicationElement.Item; bool flag = false; bool flag2 = false; CalendarItemBaseData calendarItemBaseData = EditCalendarItemHelper.GetUserContextData(owaContext.UserContext); StoreObjectId storeObjectId = QueryStringUtilities.CreateItemStoreObjectId(owaContext.UserContext.MailboxSession, owaContext.HttpContext.Request, false); if (calendarItemBaseData != null && calendarItemBaseData.Id != null && storeObjectId != null && !calendarItemBaseData.Id.Equals(storeObjectId)) { EditCalendarItemHelper.ClearUserContextData(owaContext.UserContext); calendarItemBaseData = null; } if (calendarItemBaseData != null) { flag = calendarItemBaseData.IsOrganizer; flag2 = calendarItemBaseData.IsMeeting; } else { if (storeObjectId == null) { throw new OwaLostContextException("Lost changes since last save."); } CalendarItemBase calendarItemBase2; CalendarItemBase calendarItemBase = calendarItemBase2 = CalendarItemBase.Bind(owaContext.UserContext.MailboxSession, storeObjectId); try { flag = calendarItemBase.IsOrganizer(); flag2 = calendarItemBase.IsMeeting; } finally { if (calendarItemBase2 != null) { ((IDisposable)calendarItemBase2).Dispose(); } } } if (flag2 && !flag) { preFormActionResponse.Action = "Read"; } else { preFormActionResponse.Action = "Open"; } string text = "ae,a,t,s"; for (int i = 0; i < owaContext.HttpContext.Request.QueryString.Count; i++) { string text2 = owaContext.HttpContext.Request.QueryString.Keys[i]; if (text.IndexOf(text2, StringComparison.Ordinal) == -1) { preFormActionResponse.AddParameter(text2, owaContext.HttpContext.Request.QueryString[text2]); } } return(preFormActionResponse); }
private CalendarItemBase ConvertToCalendarItem(GlobalObjectId goid, Item promotedItem, object[] matchedItem) { CalendarItemBase calendarItemBase = null; bool itemCreated = true; bool flag = false; promotedItem[InternalSchema.BodyTag] = promotedItem.Body.CalculateBodyTag(); try { if (matchedItem == null) { ExTraceGlobals.SharingTracer.TraceDebug <GlobalObjectId, object, object>((long)this.GetHashCode(), "CalendarImporter::ConvertToCalendarItem. No matched existing object found, then create a new one. GOID:{0}; Subject:{1}; StartTime:{2}.", goid, promotedItem.TryGetProperty(ItemSchema.Subject), promotedItem.TryGetProperty(CalendarItemInstanceSchema.StartTime)); calendarItemBase = CalendarItem.Create(this.session, this.folder.Id); } else if (this.IsMeetingChanged(goid, promotedItem, matchedItem)) { StoreObjectId storeObjectId = ((VersionedId)matchedItem[this.QueryIndexId]).ObjectId; if (!goid.IsCleanGlobalObjectId && true.Equals(matchedItem[this.QueryIndexRecurring])) { storeObjectId = new OccurrenceStoreObjectId(storeObjectId.ProviderLevelItemId, goid.Date); } try { calendarItemBase = CalendarItemBase.Bind(this.session, storeObjectId); calendarItemBase.OpenAsReadWrite(); itemCreated = false; } catch (OccurrenceNotFoundException) { ExTraceGlobals.SharingTracer.TraceDebug <string>((long)this.GetHashCode(), "CalendarImporter::ConvertToCalendarItem. Tried to bind to an occurrence not existing", storeObjectId.ToString()); calendarItemBase = CalendarItem.Create(this.session, this.folder.Id); } } if (calendarItemBase != null) { try { this.CopyToCalendarItem(promotedItem, calendarItemBase, itemCreated); flag = true; goto IL_154; } catch (RecurrenceException arg) { ExTraceGlobals.SharingTracer.TraceDebug <GlobalObjectId, RecurrenceException>((long)this.GetHashCode(), "CalendarImporter::ConvertToCalendarItem. Failed to copy the iCal to a calendarItem for ID:{0}, Exception = {1}", goid, arg); flag = false; goto IL_154; } catch (AttachmentExceededException arg2) { ExTraceGlobals.SharingTracer.TraceDebug <GlobalObjectId, AttachmentExceededException>((long)this.GetHashCode(), "CalendarImporter::ConvertToCalendarItem. Failed to copy the iCal to a calendarItem for ID:{0}, Exception = {1}", goid, arg2); flag = false; goto IL_154; } } flag = true; IL_154 :; } finally { if (!flag) { ExTraceGlobals.SharingTracer.TraceDebug <GlobalObjectId>((long)this.GetHashCode(), "CalendarImporter::ConvertToCalendarItem. Failed to convert to XSO calendar item. GOID:{0}.", goid); this.results.RawErrors.Add(ServerStrings.SyncFailedToCreateNewItemOrBindToExistingOne); Util.DisposeIfPresent(calendarItemBase); calendarItemBase = null; } } return(calendarItemBase); }
public ICalendarItemBase BindToCalendarItemBase(IStoreSession session, StoreId storeId, ICollection <PropertyDefinition> propsToReturn = null) { return(CalendarItemBase.Bind((StoreSession)session, storeId, propsToReturn)); }
public CalendarItemBase GetCorrelatedItem(GlobalObjectId globalObjectId) { MailboxSession mailboxSession = (MailboxSession)base.Session; StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Calendar); if (defaultFolderId == null) { ExTraceGlobals.MeetingMessageTracer.Information((long)this.GetHashCode(), "ReminderMessage::GetCorrelatedItem. Calendar folder is not found. We treat it as correlated calendar item has been deleted."); return(null); } CalendarItemBase calendarItemBase = null; bool flag = false; try { using (CalendarFolder calendarFolder = CalendarFolder.Bind(mailboxSession, defaultFolderId)) { int i = 0; while (i < 2) { ExTraceGlobals.MeetingMessageTracer.Information <GlobalObjectId, int>((long)this.GetHashCode(), "Storage.MeetingMessage.GetCorrelatedItemInternal: GOID={0}. Retrying fetch count={1}", globalObjectId, i); this.correlatedItemId = calendarFolder.GetCalendarItemId(globalObjectId.Bytes); if (this.correlatedItemId != null) { try { calendarItemBase = CalendarItemBase.Bind(mailboxSession, this.correlatedItemId.ObjectId); } catch (OccurrenceNotFoundException arg) { ExTraceGlobals.MeetingMessageTracer.Information <GlobalObjectId, OccurrenceNotFoundException>((long)this.GetHashCode(), "Storage.MeetingMessage.GetCorrelatedItemInternal: GOID={0}. Occurrence not found. Exception: {1}", globalObjectId, arg); this.correlatedItemId = null; break; } catch (ObjectNotFoundException arg2) { ExTraceGlobals.MeetingMessageTracer.Information <GlobalObjectId, ObjectNotFoundException>((long)this.GetHashCode(), "Storage.MeetingMessage.GetCorrelatedItemInternal: GOID={0}. Calendar item id was found but calendar item got deleted. Exception: {1}", globalObjectId, arg2); this.correlatedItemId = null; goto IL_106; } catch (WrongObjectTypeException innerException) { throw new CorruptDataException(ServerStrings.ExNonCalendarItemReturned("Unknown"), innerException); } catch (ArgumentException innerException2) { throw new CorruptDataException(ServerStrings.ExNonCalendarItemReturned("Unknown"), innerException2); } goto IL_FF; IL_106: i++; continue; IL_FF: flag = true; return(calendarItemBase); } break; } } } finally { if (!flag) { Util.DisposeIfPresent(calendarItemBase); } } return(null); }
// Token: 0x06000796 RID: 1942 RVA: 0x00039B98 File Offset: 0x00037D98 public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action) { if (owaContext == null) { throw new ArgumentNullException("owaContext"); } applicationElement = ApplicationElement.Item; type = null; action = "Open"; state = string.Empty; CalendarItemBase calendarItemBase = null; string queryStringParameter = Utilities.GetQueryStringParameter(owaContext.HttpContext.Request, "id"); UserContext userContext = owaContext.UserContext; OwaStoreObjectId preFormActionId = OwaStoreObjectId.CreateFromString(queryStringParameter); bool flag = false; Item item = null; bool flag2 = false; try { calendarItemBase = Utilities.GetItemForRequest <CalendarItemBase>(owaContext, out item, false, new PropertyDefinition[] { StoreObjectSchema.EffectiveRights }); flag2 = (item != null); } catch (ObjectNotFoundException) { ExTraceGlobals.CalendarDataTracer.TraceDebug(0L, "calendar item could not be found."); string queryStringParameter2 = Utilities.GetQueryStringParameter(owaContext.HttpContext.Request, "gid", false); if (string.IsNullOrEmpty(queryStringParameter2)) { throw; } byte[] globalObjectIdBytes = null; VersionedId versionedId = null; try { globalObjectIdBytes = Convert.FromBase64String(queryStringParameter2); } catch (FormatException innerException) { throw new OwaInvalidRequestException("Invalid global object id for conflicting calendar item", innerException); } string queryStringParameter3 = Utilities.GetQueryStringParameter(owaContext.HttpContext.Request, "fid", false); OwaStoreObjectId owaStoreObjectId = null; if (!string.IsNullOrEmpty(queryStringParameter3)) { owaStoreObjectId = OwaStoreObjectId.CreateFromString(queryStringParameter3); } else { owaStoreObjectId = userContext.CalendarFolderOwaId; } using (CalendarFolder folder = Utilities.GetFolder <CalendarFolder>(userContext, owaStoreObjectId, new PropertyDefinition[0])) { versionedId = folder.GetCalendarItemId(globalObjectIdBytes); } if (versionedId == null) { throw; } MailboxSession session = (MailboxSession)owaStoreObjectId.GetSession(userContext); calendarItemBase = CalendarItemBase.Bind(session, versionedId, new StorePropertyDefinition[] { StoreObjectSchema.EffectiveRights }); flag = true; } finally { using (item) { using (calendarItemBase) { if (calendarItemBase != null) { if (!Utilities.IsPublic(calendarItemBase) && calendarItemBase.IsMeeting && !calendarItemBase.IsOrganizer()) { type = "IPM.Schedule.Meeting.Request"; } else { type = "IPM.Appointment"; if (flag2 || !ItemUtility.UserCanEditItem(calendarItemBase) || Utilities.IsItemInExternalSharedInFolder(userContext, calendarItemBase)) { action = string.Empty; } } if (!flag2) { if (flag) { owaContext.PreFormActionId = OwaStoreObjectId.CreateFromStoreObject(calendarItemBase); } else { owaContext.PreFormActionId = preFormActionId; } } } } } } return(null); }