protected override void InternalDelete(ConfigurableObject instance)
        {
            PublicFolder publicFolder = instance as PublicFolder;

            if (publicFolder == null)
            {
                throw new NotSupportedException(ServerStrings.ExceptionIsNotPublicFolder(instance.GetType().FullName));
            }
            if (publicFolder.ObjectState == ObjectState.Deleted)
            {
                throw new InvalidOperationException(ServerStrings.ExceptionObjectHasBeenDeleted);
            }
            AggregateOperationResult aggregateOperationResult = this.PublicFolderSession.Delete(DeleteItemFlags.HardDelete, new StoreId[]
            {
                this.PublicFolderSession.IdConverter.GetSessionSpecificId(publicFolder.InternalFolderIdentity.ObjectId)
            });

            if (aggregateOperationResult != null && aggregateOperationResult.OperationResult != OperationResult.Succeeded)
            {
                StringBuilder stringBuilder = new StringBuilder();
                foreach (GroupOperationResult groupOperationResult in aggregateOperationResult.GroupOperationResults)
                {
                    if (groupOperationResult.OperationResult != OperationResult.Succeeded && groupOperationResult.Exception != null)
                    {
                        stringBuilder.AppendLine(groupOperationResult.Exception.ToString());
                    }
                }
                throw new StoragePermanentException(ServerStrings.ErrorFailedToDeletePublicFolder(publicFolder.Identity.ToString(), stringBuilder.ToString()));
            }
        }
        // Token: 0x060007AD RID: 1965 RVA: 0x00036BD8 File Offset: 0x00034DD8
        internal void DeleteMessage(StoreSession itemStore, StoreObject item)
        {
            bool   flag = false;
            string arg  = null;

            if (item is MeetingForwardNotification)
            {
                flag = true;
                arg  = ((MeetingMessage)item).Subject;
            }
            AggregateOperationResult aggregateOperationResult = itemStore.Delete(DeleteItemFlags.MoveToDeletedItems, new StoreId[]
            {
                item.Id
            });

            if (aggregateOperationResult.OperationResult == OperationResult.Succeeded)
            {
                CalendarAssistantPerformanceCounters.MeetingMessagesDeleted.Increment();
                if (flag)
                {
                    string info = string.Format("MFN with subject {0} was moved to deleted items.", arg);
                    MfnLog.LogEntry((MailboxSession)itemStore, info);
                    return;
                }
            }
            else if (flag)
            {
                string info = string.Format("MFN with subject {0} failed to be moved to deleted items. Error = {1}", arg, aggregateOperationResult);
                MfnLog.LogEntry((MailboxSession)itemStore, info);
            }
        }
        // Token: 0x06000760 RID: 1888 RVA: 0x00028FC4 File Offset: 0x000271C4
        public void Execute()
        {
            StoreObjectId storeObjectId = this.GetStoreObjectId(this.folderId);
            Folder        folder        = null;

            try
            {
                folder = Folder.Bind(this.mailboxSession, storeObjectId, null);
                if (this.deleteSubFolders)
                {
                    GroupOperationResult groupOperationResult = folder.DeleteAllObjects(DeleteItemFlags.SoftDelete);
                    if (groupOperationResult.OperationResult == OperationResult.PartiallySucceeded)
                    {
                        throw new AirSyncPermanentException(StatusCode.ItemOperations_PartialSuccess, false)
                              {
                                  ErrorStringForProtocolLogger = "PartialSuccessInEmptyFolder"
                              };
                    }
                    if (groupOperationResult.OperationResult == OperationResult.Failed)
                    {
                        throw new AirSyncPermanentException(StatusCode.Sync_InvalidSyncKey, false)
                              {
                                  ErrorStringForProtocolLogger = "FailureInEmptyFolder"
                              };
                    }
                }
                else
                {
                    AggregateOperationResult aggregateOperationResult = folder.DeleteAllItems(DeleteItemFlags.SoftDelete);
                    if (aggregateOperationResult.OperationResult == OperationResult.PartiallySucceeded)
                    {
                        throw new AirSyncPermanentException(StatusCode.ItemOperations_PartialSuccess, false)
                              {
                                  ErrorStringForProtocolLogger = "PartialSuccessInEmptyFolder2"
                              };
                    }
                    if (aggregateOperationResult.OperationResult == OperationResult.Failed)
                    {
                        throw new AirSyncPermanentException(StatusCode.Sync_InvalidSyncKey, false)
                              {
                                  ErrorStringForProtocolLogger = "FailureInEmptyFolder2"
                              };
                    }
                }
            }
            catch (ObjectNotFoundException innerException)
            {
                throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, innerException, false)
                      {
                          ErrorStringForProtocolLogger = "NotFoundInEmptyFolder2"
                      };
            }
            finally
            {
                if (folder != null)
                {
                    folder.Dispose();
                }
            }
        }
        protected override void ProcessCommand(FolderCommand.FolderRequest folderRequest, XmlDocument doc)
        {
            string                    namespaceURI      = doc.DocumentElement.NamespaceURI;
            DefaultFolderType         defaultFolderType = base.MailboxSession.IsDefaultFolderType(folderRequest.ServerId);
            AirSyncPermanentException ex;

            if (defaultFolderType != DefaultFolderType.None)
            {
                base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "DeleteOfDefaultFolder");
                ex = new AirSyncPermanentException(StatusCode.Sync_InvalidSyncKey, base.ConstructErrorXml(StatusCode.Sync_InvalidSyncKey), null, false);
                throw ex;
            }
            AggregateOperationResult aggregateOperationResult = base.MailboxSession.Delete(DeleteItemFlags.SoftDelete, new StoreObjectId[]
            {
                folderRequest.ServerId
            });

            if (aggregateOperationResult.OperationResult != OperationResult.Failed)
            {
                base.FolderHierarchySync.RecordClientOperation(folderRequest.ServerId, ChangeType.Delete, null);
                folderRequest.RecoverySyncKey = folderRequest.SyncKey;
                folderRequest.SyncKey         = base.GetNextNumber(folderRequest.SyncKey);
                base.SyncStateChanged         = true;
                base.FolderHierarchySyncState[CustomStateDatumType.SyncKey]         = new Int32Data(folderRequest.SyncKey);
                base.FolderHierarchySyncState[CustomStateDatumType.RecoverySyncKey] = new Int32Data(folderRequest.RecoverySyncKey);
                FolderIdMapping   folderIdMapping = (FolderIdMapping)base.FolderIdMappingSyncState[CustomStateDatumType.IdMapping];
                FolderTree        folderTree      = (FolderTree)base.FolderIdMappingSyncState[CustomStateDatumType.FullFolderTree];
                MailboxSyncItemId folderId        = MailboxSyncItemId.CreateForNewItem(folderRequest.ServerId);
                folderTree.RemoveFolderAndChildren(folderId, folderIdMapping);
                folderIdMapping.CommitChanges();
                base.ProtocolLogger.IncrementValue("F", PerFolderProtocolLoggerData.ClientDeletes);
                XmlNode xmlNode = doc.CreateElement("Status", namespaceURI);
                xmlNode.InnerText = "1";
                XmlNode xmlNode2 = doc.CreateElement("SyncKey", namespaceURI);
                xmlNode2.InnerText = folderRequest.SyncKey.ToString(CultureInfo.InvariantCulture);
                doc.DocumentElement.AppendChild(xmlNode);
                doc.DocumentElement.AppendChild(xmlNode2);
                return;
            }
            if (aggregateOperationResult.GroupOperationResults != null && aggregateOperationResult.GroupOperationResults.Length > 0 && aggregateOperationResult.GroupOperationResults[0] != null && aggregateOperationResult.GroupOperationResults[0].Exception is ObjectNotFoundException)
            {
                base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "DeleteOfNonExistentFolder");
                ex = new AirSyncPermanentException(StatusCode.Sync_ProtocolError, base.ConstructErrorXml(StatusCode.Sync_ProtocolError), null, false);
                throw ex;
            }
            base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "DeleteFailed");
            ex = new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, base.ConstructErrorXml(StatusCode.Sync_ClientServerConversion), null, false);
            throw ex;
        }
 // Token: 0x06001565 RID: 5477 RVA: 0x0007DE00 File Offset: 0x0007C000
 protected void DeleteMessage(MessageItem message, DeleteItemFlags deletedItemFlag = DeleteItemFlags.HardDelete)
 {
     message.Load();
     if (message.Id != null)
     {
         AggregateOperationResult aggregateOperationResult = base.MailboxSession.Delete(deletedItemFlag, new StoreId[]
         {
             message.Id.ObjectId
         });
         if (OperationResult.Succeeded != aggregateOperationResult.OperationResult)
         {
             AirSyncDiagnostics.TraceDebug <MessageItem>(ExTraceGlobals.RequestsTracer, this, "Failed to delete {0}", message);
         }
     }
 }
Exemple #6
0
 private static void DeleteMessage(MessageItem message, MailboxSession mailboxSession, object traceObject)
 {
     message.Load();
     if (message.Id != null)
     {
         AggregateOperationResult aggregateOperationResult = mailboxSession.Delete(DeleteItemFlags.HardDelete, new StoreId[]
         {
             message.Id.ObjectId
         });
         if (OperationResult.Succeeded != aggregateOperationResult.OperationResult)
         {
             AirSyncDiagnostics.TraceDebug <MessageItem>(ExTraceGlobals.RequestsTracer, traceObject, "Failed to delete {0}", message);
         }
     }
 }
Exemple #7
0
        protected override bool InternalExecute()
        {
            ExchangeVersion.Current = ExchangeVersion.Latest;
            MailboxSession           mailboxIdentityMailboxSession = base.MailboxIdentityMailboxSession;
            IdAndSession             idAndSession             = base.IdConverter.ConvertFolderIdToIdAndSession(this.folderId, IdConverter.ConvertOption.IgnoreChangeKey);
            AggregateOperationResult aggregateOperationResult = mailboxIdentityMailboxSession.Delete(DeleteItemFlags.MoveToDeletedItems, new StoreId[]
            {
                idAndSession.Id
            });

            if (aggregateOperationResult.OperationResult == OperationResult.Succeeded)
            {
                PeopleFilterGroupPriorityManager peopleFilterGroupPriorityManager = new PeopleFilterGroupPriorityManager(mailboxIdentityMailboxSession, new XSOFactory());
                mailboxIdentityMailboxSession.ContactFolders.MyContactFolders.Set(peopleFilterGroupPriorityManager.GetMyContactFolderIds());
                return(true);
            }
            return(false);
        }
Exemple #8
0
        public override void PerformBatchOperation(object[][] batchedItemBuffer, int fetchedItemCount, StoreId currentFolderId, MailboxSession sourceMailbox, MailboxSession targetMailbox, Dictionary <StoreId, FolderNode> folderNodeMap, SearchResultProcessor processor)
        {
            StoreId[] array = new StoreId[fetchedItemCount];
            for (int i = 0; i < fetchedItemCount; i++)
            {
                array[i] = (StoreId)batchedItemBuffer[i][0];
            }
            processor.BackOffFromSourceStore();
            AggregateOperationResult aggregateOperationResult = null;

            using (Folder folder = Folder.Bind(sourceMailbox, currentFolderId))
            {
                lock (sourceMailbox)
                {
                    if (processor.IsAborted())
                    {
                        return;
                    }
                    aggregateOperationResult = folder.DeleteObjects(DeleteItemFlags.HardDelete, array);
                }
            }
            if (aggregateOperationResult.OperationResult == OperationResult.Succeeded)
            {
                SearchMailboxAction.Tracer.TraceDebug <int, string>((long)this.GetHashCode(), "SearchMailboxWoker progressed with {0} message deletes on mailbox {1}", array.Length, processor.GetSourceUserName());
                return;
            }
            string empty = string.Empty;

            if (!DeleteSearchMailboxAction.DeleteItemByItem(batchedItemBuffer, fetchedItemCount, currentFolderId, sourceMailbox, processor, out empty))
            {
                foreach (GroupOperationResult groupOperationResult in aggregateOperationResult.GroupOperationResults)
                {
                    if (groupOperationResult.OperationResult != OperationResult.Succeeded && !(groupOperationResult.Exception is RecoverableItemsAccessDeniedException))
                    {
                        SearchMailboxAction.Tracer.TraceError <OperationResult, LocalizedException>((long)this.GetHashCode(), "DeleteItems operation failed with operation result: {0} and exception: {1}", groupOperationResult.OperationResult, groupOperationResult.Exception);
                        SearchMailboxException e = new SearchMailboxException(new LocalizedString(empty), groupOperationResult.Exception);
                        processor.ReportActionException(e);
                    }
                }
                return;
            }
            SearchMailboxAction.Tracer.TraceDebug <int, string>((long)this.GetHashCode(), "Item by Item delete succeded with {0} message deletes on mailbox {1}", array.Length, processor.GetSourceUserName());
        }
Exemple #9
0
        public static void DeleteWorkingSetPartition(MailboxSession mailboxSession, string workingSetSourcePartitionInternal)
        {
            StoreObjectId storeObjectId = WorkingSetUtils.FindWorkingSetPartitionFolder(mailboxSession, workingSetSourcePartitionInternal);

            if (storeObjectId != null)
            {
                using (Folder folder = WorkingSetUtils.SafeBindToWorkingSetFolder(mailboxSession))
                {
                    AggregateOperationResult aggregateOperationResult = folder.DeleteObjects(DeleteItemFlags.HardDelete, new StoreId[]
                    {
                        storeObjectId
                    });
                    if (aggregateOperationResult.OperationResult != OperationResult.Succeeded)
                    {
                        throw new ObjectNotFoundException(new LocalizedString(string.Format("Delete partition failed, partition {0} is not found", workingSetSourcePartitionInternal)));
                    }
                    WorkingSet.PartitionsDeleted.Increment();
                    return;
                }
            }
            throw new ObjectNotFoundException(new LocalizedString(string.Format("Delete partition failed, partition {0} is not found", workingSetSourcePartitionInternal)));
        }
 // Token: 0x060007B3 RID: 1971 RVA: 0x0003708C File Offset: 0x0003528C
 private void QueryAndDeleteMatchingItems(MailboxSession itemStore, MeetingMessage item, CalendarItemBase originalCalendarItem, byte[] itemGloblObjectId, string internetMessageId, string sentRepresenting, int itemSequenceNumber, ref OldMessageDeletion.LatestItemInfo latestInfo)
 {
     try
     {
         List <VersionedId> list = this.QueryMatchingItems(itemStore, item, itemGloblObjectId, sentRepresenting, itemSequenceNumber, ref latestInfo);
         if (item is MeetingRequest && itemSequenceNumber >= latestInfo.LatestSequenceNumber)
         {
             OldMessageDeletion.ApplyRollingHighlight((MeetingRequest)item, internetMessageId, originalCalendarItem, latestInfo);
         }
         if (list != null && list.Count != 0)
         {
             StoreId[] array = list.ToArray();
             OldMessageDeletion.Tracer.TraceDebug <object, ArrayTracer <StoreId> >((long)this.GetHashCode(), "{0}: Deleting message: {1}", TraceContext.Get(), new ArrayTracer <StoreId>(array));
             CalendarAssistant.TracerPfd.TracePfd <int, object, ArrayTracer <StoreId> >((long)this.GetHashCode(), "PFD IWC {0} {1}: Deleting message: {2}", 29847, TraceContext.Get(), new ArrayTracer <StoreId>(array));
             AggregateOperationResult aggregateOperationResult = itemStore.Delete(DeleteItemFlags.MoveToDeletedItems, array);
             OldMessageDeletion.Tracer.TraceDebug <object, OperationResult>((long)this.GetHashCode(), "{0}: Deleting items returned: {1}", TraceContext.Get(), aggregateOperationResult.OperationResult);
             CalendarAssistantPerformanceCounters.MeetingMessagesDeleted.IncrementBy((long)list.Count);
         }
     }
     catch (ObjectNotFoundException arg)
     {
         OldMessageDeletion.Tracer.TraceDebug <object, ObjectNotFoundException>((long)this.GetHashCode(), "{0}: Stopped OMD because we encountered an exception: {1}", TraceContext.Get(), arg);
     }
 }
Exemple #11
0
        private static ApprovalRequestUpdater.Result FindAndUpdateExistingApprovalRequest(MessageItem updateMessage, int decision, string decisionMaker, ExDateTime decisionTime, string messageId)
        {
            bool   updated = false;
            string local;
            string domain;

            if (!FindMessageUtils.TryParseMessageId(messageId, out local, out domain))
            {
                return(ApprovalRequestUpdater.Result.InvalidUpdateMessage);
            }
            ApprovalRequestUpdater.diag.TraceDebug <string>(0L, "Update approval request: messageid={0}", messageId);
            MessageStatus messageStatus = StorageExceptionHandler.RunUnderExceptionHandler(ApprovalRequestUpdater.MessageConverterInstance, delegate
            {
                MailboxSession mailboxSession = (MailboxSession)updateMessage.Session;
                StoreObjectId storeObjectId   = null;
                for (int i = 0; i < 25; i++)
                {
                    string internetMessageId  = ApprovalRequestWriter.FormatApprovalRequestMessageId(local, i, domain, false);
                    IStorePropertyBag[] array = AllItemsFolderHelper.FindItemsFromInternetId(mailboxSession, internetMessageId, new PropertyDefinition[]
                    {
                        ItemSchema.Id
                    });
                    if (array != null && array.Length > 0)
                    {
                        ApprovalRequestUpdater.diag.TraceDebug <int>(0L, "Found {0} to update, picking the first.", array.Length);
                        storeObjectId = ((VersionedId)array[0][ItemSchema.Id]).ObjectId;
                        break;
                    }
                }
                if (storeObjectId != null)
                {
                    using (MessageItem messageItem = MessageItem.Bind(mailboxSession, storeObjectId))
                    {
                        if (ApprovalRequestUpdater.VerifyAndUpdateApprovalRequest(mailboxSession, updateMessage.Sender, decision, decisionMaker, decisionTime, messageItem))
                        {
                            ConflictResolutionResult conflictResolutionResult = messageItem.Save(SaveMode.ResolveConflicts);
                            if (conflictResolutionResult.SaveStatus != SaveResult.Success)
                            {
                                ApprovalRequestUpdater.diag.TraceDebug <string, SaveResult>(0L, "Saving message: {0}, resulted in an update conflict ({1}). Ignored", messageId, conflictResolutionResult.SaveStatus);
                            }
                            AggregateOperationResult aggregateOperationResult = mailboxSession.Delete(DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                            {
                                storeObjectId
                            });
                            if (aggregateOperationResult.OperationResult != OperationResult.Succeeded)
                            {
                                ApprovalRequestUpdater.diag.TraceDebug <string, OperationResult>(0L, "Delete message: {0}, resulted in failure {1} Ignored", messageId, aggregateOperationResult.OperationResult);
                            }
                            updated = true;
                        }
                    }
                }
            });

            if (!updated)
            {
                ApprovalRequestUpdater.diag.TraceDebug <string>(0L, "Couldn't find message: {0}, ignored", messageId);
                return(ApprovalRequestUpdater.Result.NotFound);
            }
            if (MessageStatus.Success != messageStatus)
            {
                ApprovalRequestUpdater.diag.TraceDebug <string, string>(0L, "Message ({0}) processing was not successful ({1}), ignoring..", messageId, (messageStatus.Exception == null) ? "NULL exception" : messageStatus.Exception.Message);
                return(ApprovalRequestUpdater.Result.SaveConflict);
            }
            return(ApprovalRequestUpdater.Result.UpdatedSucessfully);
        }
        // Token: 0x06000779 RID: 1913 RVA: 0x00034A3C File Offset: 0x00032C3C
        private void HandleMeetingMessage(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item, List <KeyValuePair <string, object> > customDataToLog)
        {
            if (item == null)
            {
                string objectClass = mapiEvent.ObjectClass;
            }
            else
            {
                string className = item.ClassName;
            }
            if (itemStore.GetDefaultFolderId(DefaultFolderType.Calendar) == null)
            {
                CalendarAssistant.GeneralTracer.TraceDebug((long)this.GetHashCode(), "{0}: Calendar folder does not exist. Skipping processing.", new object[]
                {
                    TraceContext.Get()
                });
                CalendarAssistantLog.LogEntry(itemStore, "Could not get default folder id", new object[0]);
                return;
            }
            if (item == null)
            {
                return;
            }
            MeetingMessage meetingMessage = item as MeetingMessage;

            if (meetingMessage != null && meetingMessage.IsArchiveMigratedMessage)
            {
                CalendarAssistant.CachedStateTracer.TraceDebug((long)this.GetHashCode(), "{0}: Skipping the processing of the meeting item as this is an EHA migration traffic.", new object[]
                {
                    TraceContext.Get()
                });
                return;
            }
            CachedState cachedState = AssistantsService.CachedObjectsList.GetCachedState(mapiEvent.MailboxGuid);
            bool        flag        = ResourceCheck.DetailedCheckForAutomatedBooking(mapiEvent, itemStore, item, cachedState);

            if (itemStore != null)
            {
                string legacyDn = itemStore.MailboxOwner.LegacyDn;
            }
            if (flag)
            {
                CalendarAssistant.CachedStateTracer.TraceDebug((long)this.GetHashCode(), "{0}: Updated the cachedState object, but this is a resource mailbox.", new object[]
                {
                    TraceContext.Get()
                });
                return;
            }
            cachedState.LockForRead();
            CalendarConfiguration calendarConfiguration;

            try
            {
                calendarConfiguration = (cachedState.State[0] as CalendarConfiguration);
            }
            finally
            {
                cachedState.ReleaseReaderLock();
            }
            if (calendarConfiguration.SkipProcessing)
            {
                CalendarAssistant.CachedStateTracer.TraceDebug((long)this.GetHashCode(), "{0}: SkipProcessing is set.", new object[]
                {
                    TraceContext.Get()
                });
                return;
            }
            if (CalendarAssistant.ShouldIgnoreMessage(itemStore, item.ParentId, meetingMessage))
            {
                return;
            }
            string text = (string)Utils.SafeGetProperty(item, ItemSchema.InternetMessageId, "<null>");

            if (CalendarAssistant.ShouldProcessMessageClass(mapiEvent) && CalendarAssistant.ShouldProcessSeriesMessages(mapiEvent, itemStore))
            {
                bool     flag2  = false;
                DateTime utcNow = DateTime.UtcNow;
                if (meetingMessage != null)
                {
                    CalendarItemBase calendarItemBase = null;
                    try
                    {
                        if (meetingMessage.IsDelegated())
                        {
                            this.calProcessor.OldMessageDeletion.PerformCleanUp(itemStore, item, calendarConfiguration, calendarItemBase, null);
                        }
                        else
                        {
                            IEnumerable <VersionedId> duplicates;
                            bool calendarItem = CalendarAssistant.GetCalendarItem(meetingMessage, CalendarAssistant.UnexpectedPathTracer, ref calendarItemBase, true, out duplicates);
                            if (calendarItem)
                            {
                                this.calProcessor.ProcessMeetingMessage(itemStore, meetingMessage, ref calendarItemBase, calendarConfiguration, duplicates, true, itemStore.MailboxOwner.IsResource.Value);
                            }
                        }
                    }
                    catch (OccurrenceCrossingBoundaryException ex)
                    {
                        CalendarAssistant.ProcessingTracer.TraceDebug <object, VersionedId>((long)meetingMessage.GetHashCode(), "{0}: Found an overlapping occurrence while processing message ID={1}. Cleaning things up and retrying", TraceContext.Get(), meetingMessage.Id);
                        StringBuilder stringBuilder = new StringBuilder(1024);
                        stringBuilder.AppendFormat("Found an overlapping occurrence while processing message ID={0}.", meetingMessage.Id);
                        if (ex.OccurrenceInfo == null)
                        {
                            CalendarAssistant.UnexpectedPathTracer.TraceError((long)this.GetHashCode(), "{0}: Unexpected: Handling OccurrenceCrossingBoundaryException, the OccurrenceInfo is null.", new object[]
                            {
                                TraceContext.Get()
                            });
                            stringBuilder.Append("Unexpected: Handling OccurrenceCrossingBoundaryException, the OccurrenceInfo is null.");
                        }
                        else
                        {
                            VersionedId versionedId = ex.OccurrenceInfo.VersionedId;
                            AggregateOperationResult aggregateOperationResult = meetingMessage.Session.Delete(DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                            {
                                versionedId
                            });
                            CalendarAssistant.ProcessingTracer.TraceDebug <object, OperationResult>((long)this.GetHashCode(), "{0}: Deleting the occurrence when handling an OccurrenceCrossingBoundaryException, returned:{1}", TraceContext.Get(), aggregateOperationResult.OperationResult);
                            stringBuilder.AppendFormat("Deleting the occurrence when handling an OccurrenceCrossingBoundaryException, returned: {0}", aggregateOperationResult.OperationResult);
                        }
                        CalendarAssistantLog.LogEntry(itemStore, ex, false, stringBuilder.ToString(), new object[0]);
                    }
                    catch (CorruptDataException ex2)
                    {
                        CalendarAssistant.ProcessingTracer.TraceDebug <object, CorruptDataException>((long)this.GetHashCode(), "{0}: Got a corrupt message, exception data:{1}", TraceContext.Get(), ex2);
                        CalendarAssistantLog.LogEntry(itemStore, ex2, false, "Got a corrupt message ID = {0}.", new object[]
                        {
                            meetingMessage.Id
                        });
                    }
                    finally
                    {
                        if (calendarItemBase != null)
                        {
                            calendarItemBase.Dispose();
                            calendarItemBase = null;
                        }
                    }
                    flag2 = true;
                }
                else if (item is MeetingInquiryMessage)
                {
                    MeetingInquiryMessage meetingInquiryMessage = (MeetingInquiryMessage)item;
                    try
                    {
                        this.calProcessor.ProcessMeetingInquiryMessage(this.cvsGateway, itemStore, meetingInquiryMessage);
                    }
                    catch (CalendarVersionStoreNotPopulatedException ex3)
                    {
                        CalendarAssistant.ProcessingTracer.TraceWarning <object, CalendarVersionStoreNotPopulatedException>((long)this.GetHashCode(), "{0}: Failed to process an inquiry message, because the CVS is not populated yet. {1}", TraceContext.Get(), ex3);
                        CalendarAssistantLog.LogEntry(itemStore, ex3, false, "Failed to process an inquiry message ID = {0}, because the CVS is not populated yet.", new object[]
                        {
                            meetingInquiryMessage.Id
                        });
                    }
                    this.calProcessor.OldMessageDeletion.DeleteMessage(itemStore, item);
                    flag2 = true;
                }
                else
                {
                    CalendarAssistant.UnexpectedPathTracer.TraceError((long)this.GetHashCode(), "{0}: Unexpected: Message class matched, but is not the correct object type. Ignoring message.", new object[]
                    {
                        TraceContext.Get()
                    });
                    CalendarAssistantLog.LogEntry(itemStore, "Unexpected: Message class matched, but is not the correct object type. Ignoring message ID = {0}.", new object[]
                    {
                        item.Id
                    });
                }
                if (flag2)
                {
                    TimeSpan timeSpan = DateTime.UtcNow.Subtract(utcNow);
                    CalendarAssistantPerformanceCounters.LastCalAssistantProcessingTime.RawValue = (long)timeSpan.TotalMilliseconds;
                    CalendarAssistantPerformanceCounters.AverageCalAssistantProcessingTime.IncrementBy((long)timeSpan.TotalMilliseconds);
                    CalendarAssistantPerformanceCounters.AverageCalAssistantProcessingTimeBase.Increment();
                    CalendarAssistantPerformanceCounters.MeetingMessagesProcessed.Increment();
                }
                CalendarAssistant.GeneralTracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Finished processing message. InternetMessgeID = {1}", TraceContext.Get(), text);
                CalendarAssistant.TracerPfd.TracePfd <int, object, string>((long)this.GetHashCode(), "PFD IWC {0} {1}: Finished processing message. InternetMessgeID = {2}", 21655, TraceContext.Get(), text);
            }
        }
Exemple #13
0
        private static bool DeleteItemByItem(object[][] batchedItemBuffer, int fetchedItemCount, StoreId currentFolderId, MailboxSession sourceMailbox, SearchResultProcessor processor, out string message)
        {
            StringBuilder stringBuilder = new StringBuilder();
            bool          result        = true;

            using (Folder folder = Folder.Bind(sourceMailbox, currentFolderId))
            {
                for (int i = 0; i < fetchedItemCount; i++)
                {
                    StoreId storeId = (StoreId)batchedItemBuffer[i][0];
                    if (!DeleteSearchMailboxAction.ItemSuccessfullyDeleted(sourceMailbox, storeId))
                    {
                        lock (sourceMailbox)
                        {
                            if (processor.IsAborted())
                            {
                                message = stringBuilder.ToString();
                                return(result);
                            }
                            AggregateOperationResult aggregateOperationResult = folder.DeleteObjects(DeleteItemFlags.HardDelete, new StoreId[]
                            {
                                storeId
                            });
                            if (aggregateOperationResult.OperationResult != OperationResult.Succeeded)
                            {
                                foreach (GroupOperationResult groupOperationResult in aggregateOperationResult.GroupOperationResults)
                                {
                                    if (groupOperationResult.OperationResult != OperationResult.Succeeded)
                                    {
                                        result = false;
                                        string text  = SearchMailboxAction.PropertyExists(batchedItemBuffer[i][3]) ? ((string)batchedItemBuffer[i][3]) : string.Empty;
                                        bool?  flag2 = null;
                                        if (SearchMailboxAction.PropertyExists(batchedItemBuffer[i][4]))
                                        {
                                            flag2 = new bool?((bool)batchedItemBuffer[i][4]);
                                        }
                                        ExDateTime?exDateTime = null;
                                        if (SearchMailboxAction.PropertyExists(batchedItemBuffer[i][5]))
                                        {
                                            exDateTime = new ExDateTime?((ExDateTime)batchedItemBuffer[i][5]);
                                        }
                                        ExDateTime?exDateTime2 = null;
                                        if (SearchMailboxAction.PropertyExists(batchedItemBuffer[i][6]))
                                        {
                                            exDateTime2 = new ExDateTime?((ExDateTime)batchedItemBuffer[i][6]);
                                        }
                                        Participant participant = null;
                                        if (SearchMailboxAction.PropertyExists(batchedItemBuffer[i][7]))
                                        {
                                            participant = (Participant)batchedItemBuffer[i][7];
                                        }
                                        string text2 = null;
                                        if (SearchMailboxAction.PropertyExists(batchedItemBuffer[i][8]))
                                        {
                                            text2 = (string)batchedItemBuffer[i][8];
                                        }
                                        string text3 = (participant != null) ? participant.DisplayName : string.Empty;
                                        string text4 = (participant != null) ? participant.EmailAddress : string.Empty;
                                        string text5 = (folder != null) ? folder.DisplayName : string.Empty;
                                        stringBuilder.Append(string.Format("\n{0}:\n {1},\"{2}\",\"{3}\",{4},{5},{6},{7},{8},{9}", new object[]
                                        {
                                            Strings.DeleteItemFailedForMessage(groupOperationResult.Exception.Message),
                                            sourceMailbox.MailboxOwner.MailboxInfo.DisplayName,
                                            text5,
                                            text,
                                            flag2,
                                            exDateTime,
                                            exDateTime2,
                                            text3,
                                            text2 ?? text4,
                                            ((VersionedId)storeId).ObjectId
                                        }));
                                    }
                                }
                            }
                        }
                    }
                }
            }
            message = stringBuilder.ToString();
            return(result);
        }
 // Token: 0x0600010E RID: 270 RVA: 0x00006844 File Offset: 0x00004A44
 internal static void HandleEventInternal(MapiEvent mapiEvent, MailboxSession session, StoreObject storeItem, MailboxData mailboxData)
 {
     ActionsProcessor.Tracer.TraceDebug(0L, "{0}: Calling ActionsProcessor.HandleEventInternal", new object[]
     {
         TraceContext.Get()
     });
     try
     {
         StoreObjectId conversationActionsFolderId = ConversationActionItem.GetConversationActionsFolderId(session, false);
         if (conversationActionsFolderId != null)
         {
             if (ArrayComparer <byte> .Comparer.Equals(mapiEvent.ParentEntryId, conversationActionsFolderId.ProviderLevelItemId))
             {
                 ConversationActionItem conversationActionItem = storeItem as ConversationActionItem;
                 if (conversationActionItem == null)
                 {
                     ActionsProcessor.Tracer.TraceError(0L, "{0}: HandleEventInternal received null item", new object[]
                     {
                         TraceContext.Get()
                     });
                 }
                 else if (conversationActionItem.IsCorrectVersion())
                 {
                     bool flag = ActionsProcessor.MergeDuplicateActionItems(session, conversationActionItem, mailboxData);
                     if (flag)
                     {
                         ActionsProcessor.Tracer.TraceDebug(0L, "{0}: Item being processed got deleted by merging duplicates", new object[]
                         {
                             TraceContext.Get()
                         });
                     }
                     else
                     {
                         ActionsProcessor.Tracer.TraceDebug <object, ConversationId>(0L, "{0}: Processing conversation action item with conversation id = {1}", TraceContext.Get(), conversationActionItem.ConversationId);
                         AggregateOperationResult result = conversationActionItem.ProcessItems(ConversationAction.AlwaysMove | ConversationAction.AlwaysDelete | ConversationAction.AlwaysCategorize);
                         ActionsProcessor.TraceAggregateOperationResult(result);
                         conversationActionItem.Save(SaveMode.ResolveConflicts);
                     }
                 }
             }
         }
     }
     catch (CorruptDataException)
     {
         ActionsProcessor.Tracer.TraceDebug(0L, "{0}: CorruptDataException thrown while processing action item", new object[]
         {
             TraceContext.Get()
         });
         byte[] valueOrDefault = storeItem.GetValueOrDefault <byte[]>(ItemSchema.ConversationIndex, new byte[0]);
         Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_CorruptConversationActionItem, null, new object[]
         {
             session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(),
             BitConverter.ToString(valueOrDefault)
         });
     }
     catch (ObjectNotFoundException)
     {
         ActionsProcessor.Tracer.TraceDebug(0L, "{0}: ObjectNotFoundException thrown while processing action item", new object[]
         {
             TraceContext.Get()
         });
     }
 }
        // Token: 0x0600050E RID: 1294 RVA: 0x00026080 File Offset: 0x00024280
        private void ExpireInBatches(List <ItemData> listToSend, Folder sourceFolder, Folder targetFolder, ElcSubAssistant elcSubAssistant, ExpirationExecutor.Action retentionActionType, int totalFailuresSoFar, ref List <Exception> allExceptionsSoFar, out List <string> foldersWithErrors, out int newMoveErrorsTotal)
        {
            int             count           = listToSend.Count;
            int             num             = 0;
            int             i               = 0;
            int             num2            = 0;
            int             num3            = 0;
            long            num4            = 0L;
            int             num5            = 0;
            int             num6            = 0;
            int             num7            = 0;
            int             num8            = 0;
            OperationResult operationResult = OperationResult.Succeeded;
            Exception       ex              = null;

            ItemData[] sourceArray = listToSend.ToArray();
            foldersWithErrors  = new List <string>();
            newMoveErrorsTotal = 0;
            try
            {
                while (i < count)
                {
                    elcSubAssistant.ThrottleStoreCallAndCheckForShutdown(this.archiveMailboxSession.MailboxOwner, ELCHealthMonitor.GetArchiveResourceHealthMonitorKeys(this.archiveMailboxSession, this.primaryMailboxSession));
                    num2 = ((count - i >= 100) ? 100 : (count - i));
                    List <VersionedId> list;
                    bool flag;
                    int  num9;
                    Dictionary <ItemData.EnforcerType, int> dictionary;
                    num4 += (long)LocalArchiveProcessor.CopyIdsToTmpArray(sourceArray, i, num2, this.MaxMessageSizeInArchive, out list, out flag, out num9, out dictionary);
                    num7 += num9;
                    num3  = list.Count;
                    if (flag)
                    {
                        foldersWithErrors.Add(sourceFolder.DisplayName);
                        LocalArchiveProcessor.Tracer.TraceDebug <LocalArchiveProcessor, string>((long)this.GetHashCode(), "{0}: Added folder {1} to the list of bad folders to be event logged.", this, sourceFolder.DisplayName);
                    }
                    if (num3 > 0)
                    {
                        GroupOperationResult groupOperationResult = sourceFolder.CopyItems(this.archiveMailboxSession, targetFolder.Id, list.ToArray());
                        if (groupOperationResult.OperationResult == OperationResult.Succeeded)
                        {
                            LocalArchiveProcessor.Tracer.TraceDebug <LocalArchiveProcessor, int>((long)this.GetHashCode(), "{0}: Copied to archive batch of {1} items. Will proceed to hard delete the batch.", this, num3);
                            try
                            {
                                this.primaryMailboxSession.COWSettings.TemporaryDisableHold = true;
                                AggregateOperationResult aggregateOperationResult = this.primaryMailboxSession.Delete(DeleteItemFlags.HardDelete | DeleteItemFlags.SuppressReadReceipt, list.ToArray());
                                operationResult = aggregateOperationResult.OperationResult;
                                ex = ElcExceptionHelper.ExtractExceptionsFromAggregateOperationResult(aggregateOperationResult);
                                goto IL_18E;
                            }
                            finally
                            {
                                this.primaryMailboxSession.COWSettings.TemporaryDisableHold = false;
                            }
                        }
                        operationResult = groupOperationResult.OperationResult;
                        ex = groupOperationResult.Exception;
                    }
                    else
                    {
                        LocalArchiveProcessor.Tracer.TraceDebug <LocalArchiveProcessor>((long)this.GetHashCode(), "{0}: The tmpList was empty during this loop. Nothing to send, don't do anything.", this);
                    }
IL_18E:
                    i   += num2;
                    num += num3;
                    if (operationResult == OperationResult.Failed || operationResult == OperationResult.PartiallySucceeded)
                    {
                        LocalArchiveProcessor.Tracer.TraceError((long)this.GetHashCode(), "{0}: An error occured when trying to expire a batch of {1} items. Expiration action is {2}. Result: {3}", new object[]
                        {
                            this,
                            num3,
                            retentionActionType.ToString(),
                            operationResult
                        });
                        Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ExpirationOfCurrentBatchFailed, null, new object[]
                        {
                            this.primaryMailboxSession.MailboxOwner,
                            retentionActionType.ToString(),
                            (sourceFolder == null) ? string.Empty : sourceFolder.DisplayName,
                            (targetFolder == null) ? string.Empty : targetFolder.DisplayName,
                            (sourceFolder == null) ? string.Empty : sourceFolder.Id.ObjectId.ToHexEntryId(),
                            (targetFolder == null) ? string.Empty : targetFolder.Id.ObjectId.ToHexEntryId(),
                            (ex == null) ? string.Empty : ex.ToString()
                        });
                        newMoveErrorsTotal++;
                        num8++;
                        if (ex != null)
                        {
                            allExceptionsSoFar.Add(ex);
                        }
                        if (totalFailuresSoFar + newMoveErrorsTotal > MailboxData.MaxErrorsAllowed)
                        {
                            throw new TransientMailboxException(Strings.descELCEnforcerTooManyErrors(this.primaryMailboxSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(), MailboxData.MaxErrorsAllowed), new AggregateException(allExceptionsSoFar), null);
                        }
                    }
                    else
                    {
                        num5 += (dictionary.ContainsKey(ItemData.EnforcerType.DumpsterExpirationEnforcer) ? dictionary[ItemData.EnforcerType.DumpsterExpirationEnforcer] : 0);
                        num6 += (dictionary.ContainsKey(ItemData.EnforcerType.ExpirationTagEnforcer) ? dictionary[ItemData.EnforcerType.ExpirationTagEnforcer] : 0);
                    }
                }
            }
            finally
            {
                ELCPerfmon.TotalItemsExpired.IncrementBy((long)num);
                ELCPerfmon.TotalSizeItemsExpired.IncrementBy(num4);
                ELCPerfmon.TotalItemsMoved.IncrementBy((long)num);
                ELCPerfmon.TotalSizeItemsMoved.IncrementBy(num4);
                if (this.statisticsLogEntry != null)
                {
                    this.statisticsLogEntry.NumberOfItemsActuallyArchivedByDumpsterExpirationEnforcer += (long)num5;
                    this.statisticsLogEntry.NumberOfItemsActuallyArchivedByTag += (long)num6;
                    this.statisticsLogEntry.NumberOfItemsSkippedDueToSizeRestrictionInArchiveProcessor += (long)num7;
                    this.statisticsLogEntry.NumberOfBatchesFailedToMoveInArchiveProcessor += (long)num8;
                }
            }
        }
Exemple #16
0
        protected override void ProcessCommand(FolderCommand.FolderRequest folderRequest, XmlDocument doc)
        {
            DefaultFolderType defaultFolderType = base.MailboxSession.IsDefaultFolderType(folderRequest.ServerId);

            if (defaultFolderType != DefaultFolderType.None)
            {
                base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "UpdateOfDefaultFolder");
                AirSyncPermanentException ex = new AirSyncPermanentException(StatusCode.Sync_ProtocolVersionMismatch, base.ConstructErrorXml(StatusCode.Sync_ProtocolVersionMismatch), null, false);
                throw ex;
            }
            if (FolderCommand.IsEmptyOrWhiteSpacesOnly(folderRequest.DisplayName))
            {
                base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "UpdateOfEmptyDisplayName");
                AirSyncPermanentException ex = new AirSyncPermanentException(StatusCode.Sync_NotificationGUID, base.ConstructErrorXml(StatusCode.Sync_NotificationGUID), null, false);
                throw ex;
            }
            string namespaceURI = doc.DocumentElement.NamespaceURI;

            using (Folder folder = Folder.Bind(base.MailboxSession, folderRequest.ServerId, null))
            {
                try
                {
                    this.ProcessFolderNameChange(folderRequest, folder);
                    if (folderRequest.ParentId.Equals(folderRequest.ServerId))
                    {
                        base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "UpdateUnderSelf");
                        AirSyncPermanentException ex = new AirSyncPermanentException(StatusCode.Sync_ProtocolVersionMismatch, base.ConstructErrorXml(StatusCode.Sync_ProtocolVersionMismatch), null, false);
                        throw ex;
                    }
                    if (!folderRequest.ParentId.Equals(folder.ParentId))
                    {
                        using (Folder.Bind(base.MailboxSession, folderRequest.ParentId, null))
                        {
                        }
                        AggregateOperationResult aggregateOperationResult = base.MailboxSession.Move(folderRequest.ParentId, new StoreObjectId[]
                        {
                            folderRequest.ServerId
                        });
                        if (aggregateOperationResult.OperationResult == OperationResult.Failed)
                        {
                            AirSyncPermanentException ex;
                            if (aggregateOperationResult.GroupOperationResults != null && aggregateOperationResult.GroupOperationResults[0] != null && aggregateOperationResult.GroupOperationResults[0].Exception is ObjectExistedException)
                            {
                                base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "UpdateOfNonExistentFolder");
                                ex = new AirSyncPermanentException(StatusCode.Sync_ProtocolVersionMismatch, base.ConstructErrorXml(StatusCode.Sync_ProtocolVersionMismatch), null, false);
                                throw ex;
                            }
                            base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "UpdateFailed");
                            ex = new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, base.ConstructErrorXml(StatusCode.Sync_ClientServerConversion), null, false);
                            throw ex;
                        }
                    }
                    FolderTree    folderTree      = (FolderTree)base.FolderIdMappingSyncState[CustomStateDatumType.FullFolderTree];
                    ISyncItemId   syncItemId      = MailboxSyncItemId.CreateForNewItem(folderRequest.ServerId);
                    StoreObjectId defaultFolderId = base.MailboxSession.GetDefaultFolderId(DefaultFolderType.Root);
                    ISyncItemId   parentId        = folderTree.GetParentId(syncItemId);
                    if (parentId != null)
                    {
                        folderTree.UnlinkChild(parentId, syncItemId);
                    }
                    if (!defaultFolderId.Equals(folderRequest.ParentId))
                    {
                        ISyncItemId parentId2 = MailboxSyncItemId.CreateForNewItem(folderRequest.ParentId);
                        folderTree.LinkChildToParent(parentId2, syncItemId);
                    }
                }
                catch (ObjectNotFoundException innerException)
                {
                    base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "ObjectNotFoundOnUpdate");
                    AirSyncPermanentException ex = new AirSyncPermanentException(StatusCode.Sync_ServerError, base.ConstructErrorXml(StatusCode.Sync_ServerError), innerException, false);
                    throw ex;
                }
                catch (ObjectExistedException innerException2)
                {
                    base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "ObjectExistedOnUpdate");
                    AirSyncPermanentException ex = new AirSyncPermanentException(StatusCode.Sync_ProtocolVersionMismatch, base.ConstructErrorXml(StatusCode.Sync_ProtocolVersionMismatch), innerException2, false);
                    throw ex;
                }
                base.FolderHierarchySync.RecordClientOperation(folder.Id.ObjectId, ChangeType.Change, folder);
                folderRequest.RecoverySyncKey = folderRequest.SyncKey;
                folderRequest.SyncKey         = base.GetNextNumber(folderRequest.SyncKey);
                base.SyncStateChanged         = true;
                base.FolderHierarchySyncState[CustomStateDatumType.SyncKey]         = new Int32Data(folderRequest.SyncKey);
                base.FolderHierarchySyncState[CustomStateDatumType.RecoverySyncKey] = new Int32Data(folderRequest.RecoverySyncKey);
                base.ProtocolLogger.IncrementValue("F", PerFolderProtocolLoggerData.ClientChanges);
            }
            XmlNode xmlNode = doc.CreateElement("Status", namespaceURI);

            xmlNode.InnerText = "1";
            XmlNode xmlNode2 = doc.CreateElement("SyncKey", namespaceURI);

            xmlNode2.InnerText = folderRequest.SyncKey.ToString(CultureInfo.InvariantCulture);
            doc.DocumentElement.AppendChild(xmlNode);
            doc.DocumentElement.AppendChild(xmlNode2);
        }
        // Token: 0x060007AE RID: 1966 RVA: 0x00036C68 File Offset: 0x00034E68
        private void DeleteOldMessages(MailboxSession itemStore, MeetingMessage item, CalendarItemBase originalCalItem, out bool fullUpdateDeleted)
        {
            fullUpdateDeleted = false;
            string text = (string)Utils.SafeGetProperty(item, ItemSchema.InternetMessageId, "<null>");

            if (item is MeetingRequest || item is MeetingCancellation)
            {
                bool flag = (bool)Utils.SafeGetProperty(item, MeetingMessageSchema.HijackedMeeting, false);
                if (flag)
                {
                    CalendarAssistantLog.LogEntry(itemStore, "Message {0} has been hijacked, skipping deletion of old messages.", new object[]
                    {
                        text
                    });
                    return;
                }
            }
            int num = (int)Utils.SafeGetProperty(item, CalendarItemBaseSchema.AppointmentSequenceNumber, -1);

            if (num < 0)
            {
                OldMessageDeletion.Tracer.TraceError <object, string>((long)this.GetHashCode(), "{0}: Message does not have a sequence number, skipping {1}", TraceContext.Get(), text);
                CalendarAssistantLog.LogEntry(itemStore, "Message does not have a sequence number, skipping {0}", new object[]
                {
                    text
                });
                return;
            }
            if (OldMessageDeletion.ShouldIgnoreFolder(itemStore, item.ParentId))
            {
                return;
            }
            string text2 = (string)Utils.SafeGetProperty(item, MessageItemSchema.ReceivedRepresentingEmailAddress, string.Empty);
            string text3 = (string)Utils.SafeGetProperty(item, CalendarItemBaseSchema.OrganizerEmailAddress, string.Empty);

            byte[] array = (byte[])Utils.SafeGetProperty(item, CalendarItemBaseSchema.GlobalObjectId, null);
            if (array == null)
            {
                OldMessageDeletion.Tracer.TraceError <object, string>((long)this.GetHashCode(), "{0}: Message {1} does not have a globalObjectId, skipping the message.", TraceContext.Get(), text);
                CalendarAssistantLog.LogEntry(itemStore, "Message {0} does not have a globalObjectId, skipping the message.", new object[]
                {
                    text
                });
                return;
            }
            OldMessageDeletion.Tracer.TraceDebug <object, string, string>((long)item.GetHashCode(), "{0}: Received representing={1} sent representing={2}", TraceContext.Get(), text2, text3);
            CalendarAssistant.TracerPfd.TracePfd((long)item.GetHashCode(), "PFD IWC {0} {1}: Received representing={2} sent representing={3}", new object[]
            {
                22679,
                TraceContext.Get(),
                text2,
                text3
            });
            if (!itemStore.IsGroupMailbox() && string.Compare(text2, text3, true) == 0)
            {
                Participant participant = null;
                if (!OldMessageDeletion.IsSenderSame(item.Sender, itemStore, out participant))
                {
                    return;
                }
                AggregateOperationResult aggregateOperationResult = itemStore.Delete(DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                {
                    item.Id
                });
                OldMessageDeletion.Tracer.TraceDebug <object, string, OperationResult>((long)this.GetHashCode(), "{0}: Moving the item {1} to the Deleted Items folder returned:{2}", TraceContext.Get(), text, aggregateOperationResult.OperationResult);
                return;
            }
            else
            {
                if (item.IsRepairUpdateMessage)
                {
                    RUMOldMessageDeletion.CleanUp(itemStore, item, originalCalItem, OldMessageDeletion.Tracer, out fullUpdateDeleted);
                    return;
                }
                OldMessageDeletion.LatestItemInfo latestItemInfo;
                latestItemInfo.FullUpdateDeleted      = fullUpdateDeleted;
                latestItemInfo.RollingHighlight       = (int)Utils.SafeGetProperty(item, CalendarItemBaseSchema.ChangeHighlight, 0);
                latestItemInfo.LatestOldStartTime     = ExDateTime.MinValue;
                latestItemInfo.LatestOldEndTime       = ExDateTime.MinValue;
                latestItemInfo.LatestOldLocationStr   = string.Empty;
                latestItemInfo.LatestSequenceNumber   = -1;
                latestItemInfo.LatestItemId           = item.Id;
                latestItemInfo.LatestClientSubmitTime = (ExDateTime)Utils.SafeGetProperty(item, ItemSchema.SentTime, ExDateTime.MinValue);
                this.QueryAndDeleteMatchingItems(itemStore, item, originalCalItem, array, text, text3, num, ref latestItemInfo);
                fullUpdateDeleted = latestItemInfo.FullUpdateDeleted;
                return;
            }
        }
Exemple #18
0
        // Token: 0x06000B71 RID: 2929 RVA: 0x00049A1C File Offset: 0x00047C1C
        protected override void HandleEventInternal(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item, List <KeyValuePair <string, object> > customDataToLog)
        {
            ResourceBookingAssistantLogEntry resourceBookingAssistantLogEntry = new ResourceBookingAssistantLogEntry
            {
                MapiEventFlag = mapiEvent.EventMask.ToString(),
                MailboxGuid   = itemStore.MailboxGuid,
                TenantGuid    = itemStore.MailboxOwner.MailboxInfo.OrganizationId.GetTenantGuid(),
                DatabaseGuid  = itemStore.MailboxOwner.MailboxInfo.GetDatabaseGuid()
            };

            try
            {
                string text = (item != null) ? item.ClassName : mapiEvent.ObjectClass;
                resourceBookingAssistantLogEntry.ObjectClass = text;
                if (itemStore.GetDefaultFolderId(DefaultFolderType.Calendar) == null)
                {
                    ResourceBookingAssistant.Tracer.TraceDebug <object, Guid>((long)this.GetHashCode(), "{0}: Mailbox: {1} - Calendar folder does not exist. Skipping processing.", TraceContext.Get(), mapiEvent.MailboxGuid);
                    resourceBookingAssistantLogEntry.IsCalendarFolderNotAvailable = true;
                }
                else
                {
                    CachedState cachedState = AssistantsService.CachedObjectsList.GetCachedState(mapiEvent.MailboxGuid);
                    bool        flag        = ResourceCheck.DetailedCheckForAutomatedBooking(mapiEvent, itemStore, item, cachedState);
                    resourceBookingAssistantLogEntry.IsAutomatedBooking = flag;
                    if (flag)
                    {
                        if (item == null)
                        {
                            ResourceBookingAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: HandleEvent was passed a null item.", new object[]
                            {
                                TraceContext.Get()
                            });
                        }
                        else
                        {
                            ResourceBookingAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Automatic Booking is on.", new object[]
                            {
                                TraceContext.Get()
                            });
                            if (item is MeetingMessage)
                            {
                                MeetingMessage meetingMessage = item as MeetingMessage;
                                resourceBookingAssistantLogEntry.MeetingSender            = meetingMessage.Sender.EmailAddress;
                                resourceBookingAssistantLogEntry.MeetingInternetMessageId = meetingMessage.InternetMessageId;
                                if (meetingMessage.IsDelegated())
                                {
                                    ResourceBookingAssistant.Tracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Deleting delegated meeting message: ID={1}", TraceContext.Get(), item.Id.ToString());
                                    itemStore.Delete(DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                                    {
                                        meetingMessage.Id
                                    });
                                    RbaLog.LogEntry(itemStore, meetingMessage, EvaluationResults.Delete);
                                    resourceBookingAssistantLogEntry.IsDelegatedMeetingRequest = true;
                                    return;
                                }
                            }
                            cachedState.LockForRead();
                            CalendarConfiguration calendarConfiguration;
                            try
                            {
                                calendarConfiguration = (cachedState.State[0] as CalendarConfiguration);
                            }
                            finally
                            {
                                cachedState.ReleaseReaderLock();
                            }
                            bool flag2 = false;
                            try
                            {
                                if (item is MeetingRequest)
                                {
                                    flag2 = (item as MeetingRequest).IsOrganizer();
                                }
                                else if (item is MeetingCancellation)
                                {
                                    flag2 = (item as MeetingCancellation).IsOrganizer();
                                }
                            }
                            catch (ObjectNotFoundException innerException)
                            {
                                ResourceBookingAssistant.Tracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Object Not Found. ID={1}", TraceContext.Get(), item.Id.ToString());
                                throw new TransientMailboxException(innerException);
                            }
                            resourceBookingAssistantLogEntry.IsOrganizer = flag2;
                            if (!ObjectClass.IsOfClass(text, "IPM.Schedule.Meeting") || flag2)
                            {
                                if (calendarConfiguration.DeleteNonCalendarItems && (mapiEvent.EventMask & MapiEventTypeFlags.NewMail) != (MapiEventTypeFlags)0)
                                {
                                    ResourceBookingAssistant.Tracer.TraceError((long)this.GetHashCode(), "{0}: Deleting a non-meeting message", new object[]
                                    {
                                        TraceContext.Get()
                                    });
                                    if (item is MessageItem)
                                    {
                                        RbaLog.LogEntry(itemStore, item as MessageItem, EvaluationResults.Delete);
                                    }
                                    itemStore.Delete(DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                                    {
                                        item.Id
                                    });
                                    resourceBookingAssistantLogEntry.DeleteNonMeetingMessage = true;
                                }
                            }
                            else
                            {
                                ResourceBookingAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Message is the right class", new object[]
                                {
                                    TraceContext.Get()
                                });
                                if (!(item is MeetingMessage))
                                {
                                    ResourceBookingAssistant.Tracer.TraceError((long)this.GetHashCode(), "{0}: Unexpected: Message class matched, but is not the correct object type. Ignoring message.", new object[]
                                    {
                                        TraceContext.Get()
                                    });
                                }
                                else
                                {
                                    ResourceBookingAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Message is MeetingMessage", new object[]
                                    {
                                        TraceContext.Get()
                                    });
                                    resourceBookingAssistantLogEntry.IsMeetingMessage = true;
                                    MeetingMessage   meetingMessage   = item as MeetingMessage;
                                    CalendarItemBase calendarItemBase = null;
                                    DateTime         utcNow           = DateTime.UtcNow;
                                    resourceBookingAssistantLogEntry.StartProcessingTime = utcNow;
                                    for (int i = 0; i < 2; i++)
                                    {
                                        IEnumerable <VersionedId> duplicates;
                                        Exception ex;
                                        bool      calendarItem = CalendarAssistant.GetCalendarItem(meetingMessage, ResourceBookingAssistant.Tracer, ref calendarItemBase, false, out duplicates, out ex);
                                        resourceBookingAssistantLogEntry.AddExceptionToLog(ex);
                                        if (!calendarItem)
                                        {
                                            break;
                                        }
                                        if (calendarItemBase == null)
                                        {
                                            ResourceBookingAssistant.Tracer.TraceDebug <object, VersionedId>((long)this.GetHashCode(), "{0}: Original CalendarItem for message {1} is null", TraceContext.Get(), meetingMessage.Id);
                                        }
                                        StoreObjectValidationError[] array = meetingMessage.Validate();
                                        if (array != null && array.Length > 0)
                                        {
                                            ResourceBookingAssistant.Tracer.TraceError <object, StoreObjectValidationError>((long)this.GetHashCode(), "{0}: mtgMessage did not validate, {1}", TraceContext.Get(), array[0]);
                                            resourceBookingAssistantLogEntry.IsMeetingMessageInvalid = true;
                                            throw new SkipException(Strings.descSkipExceptionFailedValidateCalItem);
                                        }
                                        string text2 = string.Empty;
                                        try
                                        {
                                            this.calProcessor.ProcessMeetingMessage(itemStore, meetingMessage, ref calendarItemBase, calendarConfiguration, duplicates, false);
                                            text2 = meetingMessage.Id.ToString();
                                            resourceBookingAssistantLogEntry.IsMeetingMessageProcessed = true;
                                            resourceBookingAssistantLogEntry.MeetingMessageId          = text2;
                                            bool flag3 = false;
                                            if (meetingMessage is MeetingRequest)
                                            {
                                                flag3 = (meetingMessage as MeetingRequest).IsOrganizer();
                                            }
                                            else if (meetingMessage is MeetingCancellation)
                                            {
                                                flag3 = (meetingMessage as MeetingCancellation).IsOrganizer();
                                            }
                                            else if (meetingMessage is MeetingResponse)
                                            {
                                                flag3 = true;
                                            }
                                            resourceBookingAssistantLogEntry.IsOrganizer = flag3;
                                            resourceBookingAssistantLogEntry.IsDelegatedMeetingRequest = meetingMessage.IsDelegated();
                                            if (calendarItemBase == null)
                                            {
                                                if (flag3)
                                                {
                                                    RbaLog.LogEntry(itemStore, meetingMessage, EvaluationResults.IgnoreOrganizer);
                                                }
                                                else if (resourceBookingAssistantLogEntry.IsDelegatedMeetingRequest)
                                                {
                                                    RbaLog.LogEntry(itemStore, meetingMessage, EvaluationResults.IgnoreDelegate);
                                                }
                                            }
                                            if (calendarItemBase == null && meetingMessage is MeetingCancellation)
                                            {
                                                ResourceBookingAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Deleting a meeting cancellation without correlated calendar item found", new object[]
                                                {
                                                    TraceContext.Get()
                                                });
                                                itemStore.Delete(DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                                                {
                                                    meetingMessage.Id
                                                });
                                                RbaLog.LogEntry(itemStore, meetingMessage, EvaluationResults.Delete);
                                                resourceBookingAssistantLogEntry.DeleteCanceledMeeting = true;
                                            }
                                            if (calendarItemBase != null)
                                            {
                                                StoreObjectValidationError[] array2 = calendarItemBase.Validate();
                                                if (array2 != null && array2.Length > 0)
                                                {
                                                    ResourceBookingAssistant.Tracer.TraceError <object, StoreObjectValidationError>((long)this.GetHashCode(), "{0}: calendar item did not validate, {1}", TraceContext.Get(), array2[0]);
                                                    throw new SkipException(Strings.descSkipExceptionFailedValidateCalItem);
                                                }
                                                ResourceBookingAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: About to process request", new object[]
                                                {
                                                    TraceContext.Get()
                                                });
                                                EvaluationResults evaluationResults = EvaluationResults.None;
                                                BookingRoles      bookingRoles      = BookingRoles.NoRole;
                                                ResourceBookingProcessing.ProcessRequest(mapiEvent, itemStore, meetingMessage, ref calendarItemBase, calendarConfiguration, out evaluationResults, out bookingRoles);
                                                resourceBookingAssistantLogEntry.IsResourceBookingRequestProcessed = true;
                                                resourceBookingAssistantLogEntry.EvaluationResult = evaluationResults.ToString();
                                                resourceBookingAssistantLogEntry.BookingRole      = bookingRoles.ToString();
                                            }
                                            break;
                                        }
                                        catch (CorruptDataException ex2)
                                        {
                                            ResourceBookingAssistant.Tracer.TraceDebug <object, string, CorruptDataException>((long)this.GetHashCode(), "{0}: The calendar item found was corrupted, so we could not do Resource Booking processing for message ID={1}, skipping event. Exception={2}", TraceContext.Get(), text2, ex2);
                                            throw new SkipException(ex2);
                                        }
                                        catch (ADTransientException arg)
                                        {
                                            ResourceBookingAssistant.Tracer.TraceDebug <object, string, ADTransientException>((long)this.GetHashCode(), "{0}: There was an tranisent AD error processing the calendar item during Resource Booking processing for message ID={1}, cleaning things up and retrying. Exception={2}", TraceContext.Get(), text2, arg);
                                            throw;
                                        }
                                        catch (ObjectNotFoundException innerException2)
                                        {
                                            ResourceBookingAssistant.Tracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Object Not Found. ID={1}", TraceContext.Get(), text2);
                                            throw new TransientMailboxException(innerException2);
                                        }
                                        catch (SaveConflictException ex3)
                                        {
                                            ResourceBookingAssistant.Tracer.TraceDebug <object, string, SaveConflictException>((long)this.GetHashCode(), "{0}: There was an error saving the calendar item during Resource Booking processing for message ID={1}, cleaning things up and retrying.Exception={2}", TraceContext.Get(), text2, ex3);
                                            resourceBookingAssistantLogEntry.AddExceptionToLog(ex3);
                                        }
                                        catch (OccurrenceCrossingBoundaryException ex4)
                                        {
                                            resourceBookingAssistantLogEntry.AddExceptionToLog(ex4);
                                            ResourceBookingAssistant.Tracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Found an overlapping occurrence while processing message ID={1}. Cleaning things up and retrying", TraceContext.Get(), text2);
                                            if (ex4.OccurrenceInfo == null)
                                            {
                                                ResourceBookingAssistant.Tracer.TraceError((long)this.GetHashCode(), "{0}: Unexpected: Handling OccurrenceCrossingBoundaryException, the OccurrenceInfo is null", new object[]
                                                {
                                                    TraceContext.Get()
                                                });
                                                break;
                                            }
                                            VersionedId versionedId = ex4.OccurrenceInfo.VersionedId;
                                            AggregateOperationResult aggregateOperationResult = meetingMessage.Session.Delete(DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                                            {
                                                versionedId
                                            });
                                            ResourceBookingAssistant.Tracer.TraceDebug <object, OperationResult>((long)this.GetHashCode(), "{0}: Deleting the occurrence when handling an OccurrenceCrossingBoundaryException, returned:{2}", TraceContext.Get(), aggregateOperationResult.OperationResult);
                                        }
                                        finally
                                        {
                                            ResourceBookingAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: In finally block.", new object[]
                                            {
                                                TraceContext.Get()
                                            });
                                            if (calendarItemBase != null)
                                            {
                                                calendarItemBase.Dispose();
                                                calendarItemBase = null;
                                            }
                                            DateTime utcNow2  = DateTime.UtcNow;
                                            TimeSpan timeSpan = utcNow2.Subtract(utcNow);
                                            ResourceBookingPerfmon.AverageResourceBookingProcessingTime.IncrementBy((long)timeSpan.TotalMilliseconds);
                                            ResourceBookingPerfmon.AverageResourceBookingProcessingTimeBase.Increment();
                                            resourceBookingAssistantLogEntry.StartProcessingTime = utcNow;
                                            resourceBookingAssistantLogEntry.StopProcessingTime  = utcNow2;
                                            ResourceBookingAssistant.TracerPfd.TracePfd <int, object, string>((long)this.GetHashCode(), "PFD IWR {0} {1}: Finished processing message. MeetingMessageID = {2}", 20247, TraceContext.Get(), text2);
                                        }
                                        i++;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex5)
            {
                resourceBookingAssistantLogEntry.AddExceptionToLog(ex5);
                throw ex5;
            }
            finally
            {
                customDataToLog.AddRange(resourceBookingAssistantLogEntry.FormatCustomData());
            }
        }
        public override void Execute()
        {
            if (!this.ShouldExecuteOnThisStage)
            {
                return;
            }
            if (base.Context.DeliveryFolder != null && this.TargetFolderId.Equals(base.Context.DeliveryFolder.Id))
            {
                base.Context.TraceDebug("Copy action: Ignoring copy to same folder.");
                return;
            }
            bool           flag           = false;
            MailboxSession mailboxSession = base.Context.StoreSession as MailboxSession;

            if (mailboxSession != null && CopyWorkItem.IsRententionPolicyEnabled(base.Context.RecipientCache, base.Context.Recipient))
            {
                base.Context.TraceDebug("Copy action: Retention policy is enabled.");
                flag = true;
            }
            if (ExecutionStage.OnPromotedMessage == base.Context.ExecutionStage)
            {
                base.Context.TraceDebug("Copy action: Creating message.");
                using (MessageItem messageItem = MessageItem.Create(base.Context.StoreSession, this.TargetFolderId))
                {
                    base.Context.TraceDebug("Copy action: Copying content from original message.");
                    Item.CopyItemContent(base.Context.Message, messageItem);
                    if (base.Context.PropertiesForAllMessageCopies != null)
                    {
                        foreach (KeyValuePair <PropertyDefinition, object> keyValuePair in base.Context.PropertiesForAllMessageCopies)
                        {
                            if (keyValuePair.Value != null)
                            {
                                base.Context.TraceDebug <string, object>("Copy action: Setting property {0} to {1}", keyValuePair.Key.Name, keyValuePair.Value);
                            }
                            else
                            {
                                base.Context.TraceDebug <string>("Copy action: Removing property {0}", keyValuePair.Key.Name);
                            }
                            messageItem.SetOrDeleteProperty(keyValuePair.Key, keyValuePair.Value);
                        }
                    }
                    MessageFlags messageFlags = messageItem.GetValueOrDefault <MessageFlags>(MessageItemSchema.Flags);
                    messageFlags |= MessageFlags.IsUnmodified;
                    messageFlags &= ~(MessageFlags.IsRead | MessageFlags.IsDraft);
                    messageItem[MessageItemSchema.Flags] = messageFlags;
                    if (flag)
                    {
                        this.TagItem(mailboxSession, messageItem);
                    }
                    else
                    {
                        base.Context.TraceDebug("Copy action: Retention policy is not enabled. Skip tagging.");
                    }
                    base.Context.TraceDebug("Copy action: Saving message.");
                    messageItem.Save(SaveMode.ResolveConflicts);
                    base.Context.TraceDebug("Copy action: Message saved.");
                    return;
                }
            }
            if (ExecutionStage.OnDeliveredMessage == base.Context.ExecutionStage)
            {
                base.Context.TraceDebug("Copy action: Loading original message.");
                base.Context.DeliveredMessage.Load(new PropertyDefinition[]
                {
                    ItemSchema.Id
                });
                if (base.Context.DeliveredMessage.Id == null)
                {
                    base.Context.TraceError("Copy action: Cannot copy message since the message is not deliverred to store.");
                    return;
                }
                if (!flag)
                {
                    if (!base.Context.FinalDeliveryFolderId.Equals(base.Context.DeliveryFolder.Id))
                    {
                        base.Context.TraceDebug("Copy action: Binding to final delivery folder.");
                        using (Folder folder = Folder.Bind(base.Context.StoreSession, base.Context.FinalDeliveryFolderId))
                        {
                            base.Context.TraceDebug("Copy action: Copying from final delivery folder.");
                            folder.CopyItems(this.TargetFolderId, new StoreId[]
                            {
                                base.Context.DeliveredMessage.Id
                            });
                            return;
                        }
                    }
                    base.Context.TraceDebug("Copy action: Copying from initial delivery folder.");
                    base.Context.DeliveryFolder.CopyItems(this.TargetFolderId, new StoreId[]
                    {
                        base.Context.DeliveredMessage.Id
                    });
                    return;
                }
                base.Context.TraceDebug("Copy action: Copying from delivery folder and fixing RetentionPolicies on Item.");
                AggregateOperationResult aggregateOperationResult = mailboxSession.Copy(mailboxSession, this.TargetFolderId, true, new StoreId[]
                {
                    base.Context.DeliveredMessage.Id
                });
                if (aggregateOperationResult.OperationResult == OperationResult.Succeeded && aggregateOperationResult.GroupOperationResults.Length == 1 && aggregateOperationResult.GroupOperationResults[0].ResultObjectIds.Count == 1)
                {
                    PropertyDefinition[] array = new PropertyDefinition[]
                    {
                        ItemSchema.Id,
                        StoreObjectSchema.PolicyTag,
                        StoreObjectSchema.RetentionFlags,
                        StoreObjectSchema.RetentionPeriod,
                        StoreObjectSchema.ArchiveTag,
                        StoreObjectSchema.ArchivePeriod,
                        FolderSchema.RetentionTagEntryId
                    };
                    using (MessageItem messageItem2 = MessageItem.Bind(base.Context.StoreSession, aggregateOperationResult.GroupOperationResults[0].ResultObjectIds[0], (ICollection <PropertyDefinition>)array))
                    {
                        messageItem2.OpenAsReadWrite();
                        this.TagItem(mailboxSession, messageItem2);
                        base.Context.TraceDebug("Copy action: Saving message.");
                        messageItem2.Save(SaveMode.ResolveConflicts);
                        base.Context.TraceDebug("Copy action: Message saved.");
                    }
                }
            }
        }
        // Token: 0x06000191 RID: 401 RVA: 0x0000B918 File Offset: 0x00009B18
        internal static AggregateException ExtractExceptionsFromAggregateOperationResult(AggregateOperationResult aggregateOperationResult)
        {
            AggregateException result = null;

            if (aggregateOperationResult != null && aggregateOperationResult.OperationResult != OperationResult.Succeeded && aggregateOperationResult.GroupOperationResults != null)
            {
                List <Exception> list = new List <Exception>();
                foreach (GroupOperationResult groupOperationResult in aggregateOperationResult.GroupOperationResults)
                {
                    if (groupOperationResult != null && groupOperationResult.Exception != null)
                    {
                        list.Add(groupOperationResult.Exception);
                    }
                }
                result = new AggregateException(list);
            }
            return(result);
        }
Exemple #21
0
        // Token: 0x060006A3 RID: 1699 RVA: 0x00034310 File Offset: 0x00032510
        internal static InfobarMessage MarkAsNotJunk(UserContext userContext, params StoreObjectId[] ids)
        {
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            if (ids == null)
            {
                throw new ArgumentNullException("ids");
            }
            InfobarMessage result = null;
            string         defaultFolderDisplayName = Utilities.GetDefaultFolderDisplayName(userContext.MailboxSession, DefaultFolderType.Inbox);

            if (ids.Length == 1)
            {
                SanitizedHtmlString sanitizedHtmlString = SanitizedHtmlString.Empty;
                string text;
                try
                {
                    text = Utilities.GetSenderSmtpAddress(ids[0].ToBase64String(), userContext);
                }
                catch (ObjectNotFoundException)
                {
                    text = null;
                }
                if (!string.IsNullOrEmpty(text) && userContext.IsJunkEmailEnabled && !JunkEmailUtilities.IsInternalToOrganization(text, userContext))
                {
                    sanitizedHtmlString = JunkEmailHelper.BuildAddToListLinkString(JunkEmailListType.SafeSenders, text);
                }
                AggregateOperationResult aggregateOperationResult = userContext.MailboxSession.Move(userContext.InboxFolderId, ids);
                if (aggregateOperationResult.OperationResult == OperationResult.Succeeded)
                {
                    if (SanitizedStringBase <OwaHtml> .IsNullOrEmpty(sanitizedHtmlString))
                    {
                        result = InfobarMessage.CreateText(string.Format(LocalizedStrings.GetNonEncoded(-1881687711), defaultFolderDisplayName, sanitizedHtmlString), InfobarMessageType.Informational);
                    }
                    else
                    {
                        result = InfobarMessage.CreateHtml(SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(-1881687711), new object[]
                        {
                            defaultFolderDisplayName,
                            sanitizedHtmlString
                        }), InfobarMessageType.Informational);
                    }
                }
                else if (SanitizedStringBase <OwaHtml> .IsNullOrEmpty(sanitizedHtmlString))
                {
                    result = InfobarMessage.CreateText(string.Format(LocalizedStrings.GetNonEncoded(300728662), sanitizedHtmlString), InfobarMessageType.Informational);
                }
                else
                {
                    result = InfobarMessage.CreateHtml(SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(300728662), new object[]
                    {
                        sanitizedHtmlString
                    }), InfobarMessageType.Informational);
                }
            }
            else
            {
                AggregateOperationResult aggregateOperationResult2 = userContext.MailboxSession.Move(userContext.InboxFolderId, ids);
                switch (aggregateOperationResult2.OperationResult)
                {
                case OperationResult.Succeeded:
                    result = InfobarMessage.CreateText(string.Format(LocalizedStrings.GetNonEncoded(1632419544), defaultFolderDisplayName), InfobarMessageType.Informational);
                    break;

                case OperationResult.Failed:
                    result = InfobarMessage.CreateLocalized(1682703853, InfobarMessageType.Informational);
                    break;

                case OperationResult.PartiallySucceeded:
                    result = InfobarMessage.CreateLocalized(521322677, InfobarMessageType.Informational);
                    break;
                }
            }
            return(result);
        }
Exemple #22
0
        // Token: 0x06000542 RID: 1346 RVA: 0x00028264 File Offset: 0x00026464
        private bool ProcessBatch(FolderIdType targetFolderId, out Exception batchException)
        {
            RemoteArchiveProcessorBase.Tracer.TraceDebug <MailboxSession, int, uint>((long)this.GetHashCode(), "RemoteArchiveProcessorBase.ProcessBatch: Process items batch for {0}.  Count = {1}, Size = {2}.", this.primaryMailboxSession, this.currentBatch.Count, this.currentBatchSize);
            batchException = null;
            if (this.currentBatch.Count == 0 || this.currentBatchSize == 0U)
            {
                return(true);
            }
            bool             flag            = true;
            int              num             = 0;
            int              num2            = 0;
            int              num3            = 0;
            int              num4            = 0;
            int              num5            = 0;
            OperationResult  operationResult = OperationResult.Succeeded;
            List <Exception> list            = new List <Exception>();

            try
            {
                Exception         ex;
                List <ElcEwsItem> list2 = this.ExportItemsFromPrimaryMailbox(this.currentBatch, out ex);
                num = list2.Count;
                if (ex != null)
                {
                    list.Add(ex);
                }
                List <ElcEwsItem> list3 = this.UploadItemsToArchiveMailbox(list2, targetFolderId, out ex);
                num2 = list3.Count;
                if (ex != null)
                {
                    list.Add(ex);
                }
                List <ElcEwsItem> list4 = null;
                list4 = this.VerifyItemsUploadedToArchiveMailbox(list3, out ex);
                num3  = list4.Count;
                if (ex != null)
                {
                    list.Add(ex);
                }
                ex = null;
                VersionedId[] array = (from elcEwsItem in list4
                                       select elcEwsItem.StorageItemData.Id).ToArray <VersionedId>();
                if (array.Length > 0)
                {
                    try
                    {
                        this.primaryMailboxSession.COWSettings.TemporaryDisableHold = true;
                        AggregateOperationResult aggregateOperationResult = this.primaryMailboxSession.Delete(DeleteItemFlags.HardDelete | DeleteItemFlags.SuppressReadReceipt, array);
                        operationResult = aggregateOperationResult.OperationResult;
                        ex = ElcExceptionHelper.ExtractExceptionsFromAggregateOperationResult(aggregateOperationResult);
                    }
                    finally
                    {
                        this.primaryMailboxSession.COWSettings.TemporaryDisableHold = false;
                    }
                    flag = (operationResult != OperationResult.Failed && operationResult != OperationResult.PartiallySucceeded);
                    if (!flag)
                    {
                        if (ex != null)
                        {
                            list.Add(ex);
                        }
                    }
                    else
                    {
                        foreach (ElcEwsItem elcEwsItem2 in list4)
                        {
                            if (elcEwsItem2.StorageItemData != null && elcEwsItem2.StorageItemData.Enforcer == ItemData.EnforcerType.DumpsterExpirationEnforcer)
                            {
                                num4++;
                            }
                            else if (elcEwsItem2.StorageItemData != null && elcEwsItem2.StorageItemData.Enforcer == ItemData.EnforcerType.ExpirationTagEnforcer)
                            {
                                num5++;
                            }
                        }
                    }
                }
                flag = (flag && num3 == this.currentBatch.Count);
            }
            finally
            {
                batchException = new AggregateException(list);
                RemoteArchiveProcessorBase.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Batch processing summary.  Batch count = {1}, Batch size = {2}, Successfully exported = {3}, Successfully uploaded = {4}, Successfully verified = {5}, Delete status = {6}, Failure = {7}", new object[]
                {
                    this,
                    this.currentBatch.Count,
                    this.currentBatchSize,
                    num,
                    num2,
                    num3,
                    operationResult,
                    batchException
                });
                this.currentBatch.Clear();
                this.currentBatchSize = 0U;
                if (this.statisticsLogEntry != null)
                {
                    this.statisticsLogEntry.NumberOfItemsActuallyArchivedByDumpsterExpirationEnforcer += (long)num4;
                    this.statisticsLogEntry.NumberOfItemsActuallyArchivedByTag += (long)num5;
                }
            }
            return(flag);
        }
Exemple #23
0
        // Token: 0x06000335 RID: 821 RVA: 0x00014474 File Offset: 0x00012674
        protected override void ExpireInBatches(List <ItemData> listToSend, ExpirationExecutor.Action retentionActionType, params StoreObjectId[] destinationFolderIds)
        {
            int             count           = listToSend.Count;
            int             i               = 0;
            int             num             = 0;
            OperationResult operationResult = OperationResult.Succeeded;
            bool            errorOccurred   = false;
            DateTime        dateTime        = DateTime.MinValue;

            try
            {
                while (i < count)
                {
                    base.ElcAssistant.ThrottleStoreCallAndCheckForShutdown(base.MailboxData.MailboxSession.MailboxOwner);
                    int           num2  = (count - i >= 100) ? 100 : (count - i);
                    VersionedId[] array = new VersionedId[num2];
                    num += base.CopyIdsToTmpArray(listToSend.ToArray(), i, array, num2);
                    i   += num2;
                    this.provisionedFolder.CurrentItems = array;
                    switch (retentionActionType)
                    {
                    case ExpirationExecutor.Action.MoveToFolder:
                    {
                        GroupOperationResult groupOperationResult = this.provisionedFolder.Folder.MoveItems(destinationFolderIds[0], array);
                        operationResult = groupOperationResult.OperationResult;
                        break;
                    }

                    case ExpirationExecutor.Action.MoveToFolderAndSet:
                    {
                        object[] values = new object[]
                        {
                            new CompositeProperty(Server.Exchange2007MajorVersion, base.MailboxData.Now).GetBytes()
                        };
                        GroupOperationResult groupOperationResult2 = this.provisionedFolder.Folder.UnsafeMoveItemsAndSetProperties(destinationFolderIds[0], array, new PropertyDefinition[]
                            {
                                ItemSchema.ElcMoveDate
                            }, values);
                        operationResult = groupOperationResult2.OperationResult;
                        break;
                    }

                    case ExpirationExecutor.Action.SoftDelete:
                    {
                        AggregateOperationResult aggregateOperationResult = this.provisionedFolder.Folder.DeleteObjects(DeleteItemFlags.SoftDelete, array);
                        operationResult = aggregateOperationResult.OperationResult;
                        break;
                    }

                    case ExpirationExecutor.Action.PermanentlyDelete:
                    {
                        AggregateOperationResult aggregateOperationResult2 = this.provisionedFolder.Folder.DeleteObjects(DeleteItemFlags.HardDelete, array);
                        operationResult = aggregateOperationResult2.OperationResult;
                        break;
                    }
                    }
                    if (operationResult == OperationResult.Failed || operationResult == OperationResult.PartiallySucceeded)
                    {
                        FolderExpirationExecutor.Tracer.TraceError((long)this.GetHashCode(), "{0}: An error occured when trying to expire a batch of {1} items. Expiration action is {2}. Result: {3}", new object[]
                        {
                            this,
                            num2,
                            retentionActionType,
                            operationResult
                        });
                        errorOccurred = true;
                        dateTime      = ((dateTime == DateTime.MinValue) ? listToSend[i - num2].MessageReceivedDate : dateTime);
                        base.MailboxData.ThrowIfErrorsOverLimit();
                    }
                }
                int num3 = this.ProcessItemsSuccessfullyExpired(listToSend, errorOccurred, dateTime);
                ELCPerfmon.TotalItemsExpired.IncrementBy((long)num3);
                ELCPerfmon.TotalSizeItemsExpired.IncrementBy((long)num);
                switch (retentionActionType)
                {
                case ExpirationExecutor.Action.MoveToFolder:
                case ExpirationExecutor.Action.MoveToFolderAndSet:
                    ELCPerfmon.TotalItemsMoved.IncrementBy((long)num3);
                    ELCPerfmon.TotalSizeItemsMoved.IncrementBy((long)num);
                    break;

                case ExpirationExecutor.Action.SoftDelete:
                    ELCPerfmon.TotalItemsSoftDeleted.IncrementBy((long)num3);
                    ELCPerfmon.TotalSizeItemsSoftDeleted.IncrementBy((long)num);
                    break;

                case ExpirationExecutor.Action.PermanentlyDelete:
                    ELCPerfmon.TotalItemsPermanentlyDeleted.IncrementBy((long)num3);
                    ELCPerfmon.TotalSizeItemsPermanentlyDeleted.IncrementBy((long)num);
                    break;
                }
            }
            catch (ObjectNotFoundException arg)
            {
                FolderExpirationExecutor.Tracer.TraceDebug <FolderExpirationExecutor, ExpirationExecutor.Action, ObjectNotFoundException>((long)this.GetHashCode(), "{0}: Either the source or the destination folder (if applicable) was not found. Skipping current action '{1}' for this folder. Exception: '{2}'", this, retentionActionType, arg);
            }
        }
Exemple #24
0
        public void Remove()
        {
            base.ThrowIfCannotActAsOwner();
            StoreObjectId nodeId = (StoreObjectId)base.GetParameter("srcNId");
            NavigationNodeGroupSection navigationNodeGroupSection = (NavigationNodeGroupSection)base.GetParameter("GS");
            NavigationNodeCollection   navigationNodeCollection   = NavigationNodeCollection.TryCreateNavigationNodeCollection(base.UserContext, base.UserContext.MailboxSession, navigationNodeGroupSection);
            List <OwaStoreObjectId>    list           = new List <OwaStoreObjectId>();
            NavigationNode             navigationNode = navigationNodeCollection.FindNavigationNodeByNodeId(nodeId);

            if (navigationNode == null)
            {
                base.RenderPartialFailure(-289549140, OwaEventHandlerErrorCode.NotSet);
            }
            else
            {
                OperationResult operationResult = (OperationResult)0;
                if (navigationNodeGroupSection != NavigationNodeGroupSection.First)
                {
                    List <NavigationNodeFolder> list2 = new List <NavigationNodeFolder>();
                    if (navigationNode is NavigationNodeFolder)
                    {
                        list2.Add(navigationNode as NavigationNodeFolder);
                    }
                    else if (navigationNode is NavigationNodeGroup)
                    {
                        NavigationNodeGroup navigationNodeGroup = navigationNode as NavigationNodeGroup;
                        foreach (NavigationNodeFolder item in navigationNodeGroup.Children)
                        {
                            list2.Add(item);
                        }
                    }
                    foreach (NavigationNodeFolder navigationNodeFolder in list2)
                    {
                        if (navigationNodeFolder.IsValid)
                        {
                            OwaStoreObjectId owaStoreObjectId = OwaStoreObjectId.CreateFromNavigationNodeFolder(base.UserContext, navigationNodeFolder);
                            MailboxSession   mailboxSession   = owaStoreObjectId.IsArchive ? ((MailboxSession)owaStoreObjectId.GetSession(base.UserContext)) : base.UserContext.MailboxSession;
                            if (navigationNodeFolder.IsFolderInSpecificMailboxSession(mailboxSession))
                            {
                                if (Utilities.IsSpecialFolderForSession(mailboxSession, navigationNodeFolder.FolderId))
                                {
                                    throw new OwaEventHandlerException("Cannot delete default folders.", LocalizedStrings.GetNonEncoded(-1164567320), true);
                                }
                                if (operationResult == (OperationResult)0)
                                {
                                    operationResult = OperationResult.Succeeded;
                                }
                                AggregateOperationResult aggregateOperationResult = mailboxSession.Delete(DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                                {
                                    navigationNodeFolder.FolderId
                                });
                                if (aggregateOperationResult.OperationResult == OperationResult.Succeeded)
                                {
                                    list.Add(OwaStoreObjectId.CreateFromNavigationNodeFolder(base.UserContext, navigationNodeFolder));
                                }
                                else
                                {
                                    operationResult = OperationResult.PartiallySucceeded;
                                }
                            }
                        }
                    }
                    if (operationResult != (OperationResult)0 && list.Count == 0)
                    {
                        operationResult = OperationResult.Failed;
                    }
                    if (operationResult == OperationResult.Failed)
                    {
                        base.RenderPartialFailure(1041829989, OwaEventHandlerErrorCode.NotSet);
                    }
                    else if (operationResult == OperationResult.PartiallySucceeded)
                    {
                        base.RenderPartialFailure(995407892, OwaEventHandlerErrorCode.NotSet);
                    }
                }
                else
                {
                    NavigationNodeFolder navigationNodeFolder2 = navigationNode as NavigationNodeFolder;
                    if (navigationNodeFolder2 != null && navigationNodeFolder2.IsFilteredView)
                    {
                        OwaStoreObjectId owaStoreObjectId2 = OwaStoreObjectId.CreateFromNavigationNodeFolder(base.UserContext, navigationNodeFolder2);
                        using (SearchFolder searchFolder = SearchFolder.Bind(owaStoreObjectId2.GetSession(base.UserContext), owaStoreObjectId2.StoreObjectId, FolderList.FolderTreeQueryProperties))
                        {
                            searchFolder[FolderSchema.SearchFolderAllowAgeout] = true;
                            searchFolder.DisplayName = Utilities.GetRandomNameForTempFilteredView(base.UserContext);
                            searchFolder.Save();
                        }
                    }
                }
                if (operationResult == (OperationResult)0 || operationResult == OperationResult.Succeeded)
                {
                    if (navigationNodeCollection.RemoveFolderOrGroupByNodeId(nodeId) != null)
                    {
                        navigationNodeCollection.Save(base.UserContext.MailboxSession);
                    }
                }
                else if (operationResult == OperationResult.PartiallySucceeded)
                {
                    foreach (OwaStoreObjectId owaStoreObjectId3 in list)
                    {
                        navigationNodeCollection.RemoveFolderByLegacyDNandId(owaStoreObjectId3.MailboxOwnerLegacyDN ?? base.UserContext.MailboxOwnerLegacyDN, owaStoreObjectId3.StoreObjectId);
                    }
                    navigationNodeCollection.Save(base.UserContext.MailboxSession);
                }
            }
            NavigationTreeDirtyFlag navigationTreeDirtyFlag = NavigationTreeDirtyFlag.None;

            if (navigationNodeGroupSection == NavigationNodeGroupSection.First)
            {
                navigationTreeDirtyFlag = NavigationTreeDirtyFlag.Favorites;
            }
            else
            {
                if (list.Count > 0)
                {
                    List <FolderTreeNode> list3 = FolderTreeNode.CreateDeletedNodesWithDirtyCheck(base.UserContext, list, out navigationTreeDirtyFlag);
                    this.Writer.Write("<div id=tn>");
                    foreach (FolderTreeNode folderTreeNode in list3)
                    {
                        folderTreeNode.RenderUndecoratedNode(this.Writer);
                    }
                    this.Writer.Write("</div>");
                }
                switch (navigationNodeGroupSection)
                {
                case NavigationNodeGroupSection.Calendar:
                    navigationTreeDirtyFlag |= NavigationTreeDirtyFlag.Calendar;
                    break;

                case NavigationNodeGroupSection.Contacts:
                    navigationTreeDirtyFlag |= NavigationTreeDirtyFlag.Contact;
                    break;

                case NavigationNodeGroupSection.Tasks:
                    navigationTreeDirtyFlag |= NavigationTreeDirtyFlag.Task;
                    break;
                }
            }
            RenderingUtilities.RenderNavigationTreeDirtyFlag(this.Writer, base.UserContext, navigationTreeDirtyFlag, (NavigationModule[])base.GetParameter("cms"));
        }
        // Token: 0x06000D04 RID: 3332 RVA: 0x00046B64 File Offset: 0x00044D64
        private bool ProcessMovePerFolder(StoreObjectId srcFldId, StoreObjectId dstFldId, List <MoveItemsCommand.ItemIdentity> itemIdList)
        {
            Folder folder = null;

            try
            {
                folder = Folder.Bind(base.MailboxSession, dstFldId, null);
            }
            catch (ObjectNotFoundException)
            {
                for (int i = 0; i < itemIdList.Count; i++)
                {
                    this.AppendNonSuccessItemXml(itemIdList[i].SyncId, "2", "Invalid destination collection id.");
                }
                return(false);
            }
            using (folder)
            {
                StoreObjectId[] array = new StoreObjectId[itemIdList.Count];
                for (int j = 0; j < itemIdList.Count; j++)
                {
                    array[j] = itemIdList[j].Id;
                }
                AggregateOperationResult aggregateOperationResult = base.MailboxSession.Move(base.MailboxSession, dstFldId, true, array);
                if (aggregateOperationResult.GroupOperationResults == null || aggregateOperationResult.GroupOperationResults.Length != 1)
                {
                    base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "GeneralFailureInMoveItems1");
                    throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.FailureInMoveOperation, null, false);
                }
                if (aggregateOperationResult.OperationResult == OperationResult.Succeeded || aggregateOperationResult.OperationResult == OperationResult.PartiallySucceeded)
                {
                    IList <StoreObjectId> resultObjectIds = aggregateOperationResult.GroupOperationResults[0].ResultObjectIds;
                    if (resultObjectIds == null || resultObjectIds.Count != itemIdList.Count)
                    {
                        base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "ItemsLostInMoveItems1");
                        throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ItemsLostAfterMove, null, false);
                    }
                    for (int k = 0; k < itemIdList.Count; k++)
                    {
                        StoreObjectId storeObjectId = resultObjectIds[k];
                        if (storeObjectId == null)
                        {
                            base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "ItemsLostInMoveItems2");
                            throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ItemsLostAfterMove, null, false);
                        }
                        string dstSyncItemId = this.GetDstSyncItemId(folder.Id.ObjectId, storeObjectId);
                        this.AppendItemXmlNode(itemIdList[k].SyncId, "3", dstSyncItemId);
                    }
                }
                else
                {
                    if (aggregateOperationResult.OperationResult != OperationResult.Failed)
                    {
                        base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "GeneralFailureInMoveItems2");
                        throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.FailureInMoveOperation, null, false);
                    }
                    for (int l = 0; l < itemIdList.Count; l++)
                    {
                        this.AppendNonSuccessItemXml(itemIdList[l].SyncId, "5", "A failure occurred during the move operation.");
                    }
                }
            }
            return(true);
        }
        public static bool RemoveFolder(AnchorContext context, MailboxSession mailboxSession, string folderName)
        {
            StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Root);
            StoreObjectId folderId        = AnchorFolder.GetFolderId(context, mailboxSession, defaultFolderId, folderName);

            if (folderId == null)
            {
                context.Logger.Log(MigrationEventType.Verbose, "couldn't find folder with name {0} treating as success", new object[]
                {
                    folderName
                });
                return(true);
            }
            using (Folder folder = Folder.Bind(mailboxSession, folderId, AnchorFolder.FolderIdPropertyDefinition))
            {
                context.Logger.Log(MigrationEventType.Information, "About to remove all messages & subfolders from {0} with id {1}", new object[]
                {
                    folderName,
                    folderId
                });
                GroupOperationResult groupOperationResult = folder.DeleteAllObjects(DeleteItemFlags.HardDelete, true);
                if (groupOperationResult.OperationResult != OperationResult.Succeeded)
                {
                    context.Logger.Log(MigrationEventType.Warning, "unsuccessfully removed messages & subfolders from {0} with id {1} with result {2}", new object[]
                    {
                        folderName,
                        folderId,
                        groupOperationResult
                    });
                    return(false);
                }
            }
            bool result;

            using (Folder folder2 = Folder.Bind(mailboxSession, defaultFolderId))
            {
                context.Logger.Log(MigrationEventType.Information, "About to remove folder {0} with id {1}", new object[]
                {
                    folderName,
                    folderId
                });
                AggregateOperationResult aggregateOperationResult = folder2.DeleteObjects(DeleteItemFlags.HardDelete, new StoreId[]
                {
                    folderId
                });
                if (aggregateOperationResult.OperationResult != OperationResult.Succeeded)
                {
                    context.Logger.Log(MigrationEventType.Warning, "unsuccessfully removed folder {0} with id {1} with result {2}", new object[]
                    {
                        folderName,
                        folderId,
                        aggregateOperationResult
                    });
                    result = false;
                }
                else
                {
                    result = true;
                }
            }
            return(result);
        }
        // Token: 0x06000301 RID: 769 RVA: 0x0001B08C File Offset: 0x0001928C
        private static bool DoMove(StoreObjectId folderId, StoreObjectId[] itemIds, string[] itemClassNames, OwaContext owaContext)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("OwaContext");
            }
            UserContext userContext = owaContext.UserContext;
            Folder      folder      = null;
            Exception   ex          = null;

            try
            {
                folder = Folder.Bind(userContext.MailboxSession, folderId, new PropertyDefinition[]
                {
                    StoreObjectSchema.ContainerClass
                });
            }
            catch (StoragePermanentException ex2)
            {
                ex = ex2;
            }
            catch (StorageTransientException ex3)
            {
                ex = ex3;
            }
            if (ex != null)
            {
                InfobarMessage.PutExceptionInfoIntoContextInfobarMessage(ex, owaContext);
                ((InfobarMessage)owaContext[OwaContextProperty.InfobarMessage]).IsActionResult = true;
                return(false);
            }
            bool flag = true;

            if (folder.ClassName != null)
            {
                for (int i = 0; i < itemClassNames.Length; i++)
                {
                    if (!MoveItemPreFormAction.IsMoveAllowed(itemClassNames[i], folder.ClassName))
                    {
                        flag = false;
                        break;
                    }
                }
            }
            folder.Dispose();
            if (!flag)
            {
                MoveItemPreFormAction.AddInfobarMessageToContext(432946224, InfobarMessageType.Error, owaContext);
                return(false);
            }
            AggregateOperationResult aggregateOperationResult = userContext.MailboxSession.Move(folderId, itemIds);
            OperationResult          operationResult          = aggregateOperationResult.OperationResult;

            if (operationResult == OperationResult.Succeeded)
            {
                MoveItemPreFormAction.AddInfobarMessageToContext(-1303045509, InfobarMessageType.Informational, owaContext);
                return(true);
            }
            if (operationResult == OperationResult.PartiallySucceeded)
            {
                MoveItemPreFormAction.AddInfobarMessageToContext(-324890159, InfobarMessageType.Error, owaContext);
                return(false);
            }
            MoveItemPreFormAction.AddInfobarMessageToContext(-842347964, InfobarMessageType.Error, owaContext);
            return(false);
        }
 // Token: 0x06000110 RID: 272 RVA: 0x00006B03 File Offset: 0x00004D03
 private static void TraceAggregateOperationResult(AggregateOperationResult result)
 {
 }