protected override void CopySingleMessage(MessageRec curMsg, IFolderProxy folderProxy, PropTag[] propsToCopyExplicitly, PropTag[] excludeProps) { ExecutionContext.Create(new DataContext[] { new OperationDataContext("MapiSourceMailbox.CopySingleMessage", OperationType.None), new EntryIDsDataContext(curMsg.EntryId) }).Execute(delegate { using (this.RHTracker.Start()) { using (MapiMessage mapiMessage = (MapiMessage)this.OpenMapiEntry(curMsg.FolderId, curMsg.EntryId, OpenEntryFlags.DontThrowIfEntryIsMissing)) { if (mapiMessage == null) { MrsTracer.Provider.Debug("Message {0} is missing in source, ignoring", new object[] { TraceUtils.DumpEntryId(curMsg.EntryId) }); } else { using (IMessageProxy messageProxy = folderProxy.OpenMessage(curMsg.EntryId)) { using (FxProxyBudgetWrapper fxProxyBudgetWrapper = new FxProxyBudgetWrapper(messageProxy, false, new Func <IDisposable>(this.RHTracker.StartExclusive), new Action <uint>(this.RHTracker.Charge))) { mapiMessage.ExportObject(fxProxyBudgetWrapper, CopyPropertiesFlags.None, excludeProps); } if (propsToCopyExplicitly != null && propsToCopyExplicitly.Length > 0) { PropValue[] props = mapiMessage.GetProps(propsToCopyExplicitly); using (this.RHTracker.StartExclusive()) { List <PropValueData> list = new List <PropValueData>(); foreach (PropValue propValue in props) { if (!propValue.IsNull() && !propValue.IsError()) { list.Add(new PropValueData(propValue.PropTag, propValue.Value)); } } if (list.Count > 0) { messageProxy.SetProps(list.ToArray()); } } } using (this.RHTracker.StartExclusive()) { messageProxy.SaveChanges(); } } } } } }); }