コード例 #1
0
ファイル: MapiUtils.cs プロジェクト: YHZX2013/exchange_diff
 private static bool ExportMessageBatch(ISourceMailbox mailbox, List <MessageRec> messages, Func <IFxProxyPool> getProxyPool, ExportMessagesFlags flags, PropTag[] propsToCopyExplicitly, PropTag[] excludeProps, TestIntegration testIntegration, out Exception failure)
 {
     failure = null;
     try
     {
         using (IFxProxyPool fxProxyPool = getProxyPool())
         {
             mailbox.ExportMessages(messages, fxProxyPool, flags, propsToCopyExplicitly, excludeProps);
         }
         return(true);
     }
     catch (Exception ex)
     {
         if (!MapiUtils.IsBadItemIndicator(ex, out failure))
         {
             if (failure != ex)
             {
                 failure.PreserveExceptionStack();
                 throw failure;
             }
             throw;
         }
     }
     return(false);
 }
コード例 #2
0
        private void SetMailboxSettings()
        {
            List <ItemPropertiesBase> mailboxSettings = base.MailboxMerger.SourceMailbox.GetMailboxSettings(GetMailboxSettingsFlags.Finalize);

            if (mailboxSettings != null)
            {
                List <BadMessageRec> badItems = new List <BadMessageRec>();
                using (List <ItemPropertiesBase> .Enumerator enumerator = mailboxSettings.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ItemPropertiesBase item = enumerator.Current;
                        if (!base.MailboxMerger.SyncState.BadItems.ContainsKey(item.GetId()))
                        {
                            CommonUtils.ProcessKnownExceptions(delegate
                            {
                                ExecutionContext.Create(new DataContext[]
                                {
                                    new ItemPropertiesDataContext(item)
                                }).Execute(delegate
                                {
                                    this.MailboxMerger.DestMailbox.SetMailboxSettings(item);
                                });
                            }, delegate(Exception failure)
                            {
                                if (MapiUtils.IsBadItemIndicator(failure))
                                {
                                    badItems.Add(BadMessageRec.MailboxSetting(failure, item));
                                    return(true);
                                }
                                return(false);
                            });
                        }
                    }
                }
                if (badItems != null && badItems.Count > 0)
                {
                    base.MailboxMerger.ReportBadItems(badItems);
                }
            }
            base.ScheduleWorkItem(new Action(this.MservSwitchOver), WorkloadType.Unknown);
        }
コード例 #3
0
 public void FinalSyncCopyMailboxData()
 {
     if (base.MRSJob.TestIntegration.RemoteExchangeGuidOverride == Guid.Empty)
     {
         using (IFxProxy fxProxy = base.DestMailbox.GetFxProxy())
         {
             using (IFxProxy fxProxy2 = base.CreateFxProxyTransmissionPipeline(fxProxy))
             {
                 base.SourceMailbox.CopyTo(fxProxy2, new PropTag[]
                 {
                     PropTag.ContainerHierarchy,
                     PropTag.ContainerContents
                 });
             }
         }
         if (this.ServerSupportsInferencePropertiesMove(base.SourceMailboxWrapper.MailboxVersion) && this.ServerSupportsInferencePropertiesMove(base.DestMailboxWrapper.MailboxVersion) && base.MRSJob.GetConfig <bool>("CopyInferenceProperties"))
         {
             byte[] badItemId = BitConverter.GetBytes(base.SourceMailbox.GetHashCode());
             CommonUtils.ProcessKnownExceptions(delegate
             {
                 List <PropValueData> list = new List <PropValueData>(2);
                 foreach (PropValueData propValueData in this.SourceMailbox.GetProps(MailboxMover.inferencePropertiesToMove))
                 {
                     if (((PropTag)propValueData.PropTag).ValueType() != PropType.Error)
                     {
                         list.Add(propValueData);
                     }
                 }
                 badItemId = BadMessageRec.ComputeKey(list.ToArray());
                 if (!this.SyncState.BadItems.ContainsKey(badItemId))
                 {
                     this.DestMailbox.SetProps(list.ToArray());
                 }
             }, delegate(Exception failure)
             {
                 if (MapiUtils.IsBadItemIndicator(failure))
                 {
                     List <BadMessageRec> list = new List <BadMessageRec>(1);
                     list.Add(BadMessageRec.InferenceData(failure, badItemId));
                     this.ReportBadItems(list);
                     return(true);
                 }
                 return(false);
             });
         }
     }
     if (base.SupportsPerUserReadUnreadDataTransfer)
     {
         base.Report.Append(MrsStrings.ReportCopyPerUserReadUnreadDataStarted);
         using (ISourceFolder folder = base.SourceMailbox.GetFolder(null))
         {
             using (IDestinationFolder folder2 = base.DestMailbox.GetFolder(null))
             {
                 using (IFxProxy fxProxy3 = folder2.GetFxProxy(FastTransferFlags.PassThrough))
                 {
                     using (IFxProxy fxProxy4 = base.CreateFxProxyTransmissionPipeline(fxProxy3))
                     {
                         folder.CopyTo(fxProxy4, CopyPropertiesFlags.CopyMailboxPerUserData, Array <PropTag> .Empty);
                     }
                 }
             }
         }
         base.Report.Append(MrsStrings.ReportCopyPerUserReadUnreadDataCompleted);
     }
 }
コード例 #4
0
ファイル: MapiUtils.cs プロジェクト: YHZX2013/exchange_diff
        public static bool IsBadItemIndicator(Exception ex)
        {
            Exception ex2;

            return(MapiUtils.IsBadItemIndicator(ex, out ex2));
        }