Beispiel #1
0
 public static void CopyItem(MessageRec messageRec, IMessage message, IFolderProxy folderProxy, PropTag[] propsToExclude)
 {
     using (IMessageProxy messageProxy = folderProxy.OpenMessage(messageRec.EntryId))
     {
         FxCollectorSerializer fxCollectorSerializer = new FxCollectorSerializer(messageProxy);
         fxCollectorSerializer.Config(0, 1);
         using (FastTransferDownloadContext fastTransferDownloadContext = FastTransferDownloadContext.CreateForDownload(FastTransferSendOption.Unicode | FastTransferSendOption.UseCpId | FastTransferSendOption.ForceUnicode, 1U, Encoding.Default, NullResourceTracker.Instance, new PropertyFilterFactory(false, false, (from ptag in propsToExclude
                                                                                                                                                                                                                                                                                                                            select new PropertyTag((uint)ptag)).ToArray <PropertyTag>()), false))
         {
             FastTransferMessageCopyTo fastTransferObject = new FastTransferMessageCopyTo(false, message, true);
             fastTransferDownloadContext.PushInitial(fastTransferObject);
             FxUtils.TransferFxBuffers(fastTransferDownloadContext, fxCollectorSerializer);
             messageProxy.SaveChanges();
         }
     }
 }
 protected override void CopySingleMessage(MessageRec message, IFolderProxy targetFolderProxy, PropTag[] propsToCopyExplicitly, PropTag[] propTagsToExclude)
 {
     ExecutionContext.Create(new DataContext[]
     {
         new OperationDataContext("PstSourceMailbox.CopySingleMessage", OperationType.None),
         new EntryIDsDataContext(message.EntryId)
     }).Execute(delegate
     {
         try
         {
             uint nodeIdFromEntryId = PstMailbox.GetNodeIdFromEntryId(this.IPst.MessageStore.Guid, message.EntryId);
             IMessage message2      = this.IPst.ReadMessage(nodeIdFromEntryId);
             if (message2 == null)
             {
                 throw new UnableToReadPSTMessagePermanentException(this.IPst.FileName, nodeIdFromEntryId);
             }
             PSTMessage pstmessage = new PSTMessage(this, message2);
             using (IMessageProxy messageProxy = targetFolderProxy.OpenMessage(message.EntryId))
             {
                 FxCollectorSerializer fxCollectorSerializer = new FxCollectorSerializer(messageProxy);
                 fxCollectorSerializer.Config(0, 1);
                 using (FastTransferDownloadContext fastTransferDownloadContext = FastTransferDownloadContext.CreateForDownload(FastTransferSendOption.Unicode | FastTransferSendOption.UseCpId | FastTransferSendOption.ForceUnicode, 1U, pstmessage.RawPropertyBag.CachedEncoding, NullResourceTracker.Instance, this.GetPropertyFilterFactory(PstMailbox.MoMTPtaFromPta(propTagsToExclude)), false))
                 {
                     FastTransferMessageCopyTo fastTransferObject = new FastTransferMessageCopyTo(false, pstmessage, true);
                     fastTransferDownloadContext.PushInitial(fastTransferObject);
                     FxUtils.TransferFxBuffers(fastTransferDownloadContext, fxCollectorSerializer);
                     messageProxy.SaveChanges();
                 }
             }
         }
         catch (PSTExceptionBase innerException)
         {
             throw new UnableToReadPSTMessagePermanentException(this.IPst.FileName, PstMailbox.GetNodeIdFromEntryId(this.IPst.MessageStore.Guid, message.EntryId), innerException);
         }
     });
 }