Exemplo n.º 1
0
        ISourceFolder ISourceMailbox.GetFolder(byte[] entryId)
        {
            MrsTracer.Provider.Function("EasSourceMailbox.GetFolder({0})", new object[]
            {
                TraceUtils.DumpEntryId(entryId)
            });
            Add           add;
            EasFolderBase easFolderBase;

            if (base.EasFolderCache.TryGetValue(entryId, out add))
            {
                easFolderBase = new EasSourceFolder(add, base.EasConnectionWrapper.UserSmtpAddress);
            }
            else if (EasMailbox.GetStringId(entryId) == EasSyntheticFolder.RootFolder.ServerId)
            {
                easFolderBase = EasSyntheticFolder.RootFolder;
            }
            else
            {
                if (!(EasMailbox.GetStringId(entryId) == EasSyntheticFolder.IpmSubtreeFolder.ServerId))
                {
                    MrsTracer.Provider.Debug("Folder with folderId '{0}' does not exist.", new object[]
                    {
                        entryId
                    });
                    return(null);
                }
                easFolderBase = EasSyntheticFolder.IpmSubtreeFolder;
            }
            return((ISourceFolder)easFolderBase.Configure(this));
        }
Exemplo n.º 2
0
 private void FlushBatchToFolder(List <MessageRec> batch, IFxProxyPool proxyPool)
 {
     if (batch.Count == 0)
     {
         return;
     }
     MrsTracer.Provider.Function("MapiSourceMailbox.FlushBatchToFolder({0} messages)", new object[]
     {
         batch.Count
     });
     byte[] folderId = batch[0].FolderId;
     using (MapiSourceFolder folder = base.GetFolder <MapiSourceFolder>(folderId))
     {
         if (folder == null)
         {
             MrsTracer.Provider.Debug("Folder {0} is missing in source. Will sync its deletion later.", new object[]
             {
                 TraceUtils.DumpEntryId(folderId)
             });
         }
         else
         {
             folder.CopyBatch(proxyPool, batch);
         }
     }
 }
Exemplo n.º 3
0
        private void ReadRulesFromAllFolders()
        {
            List <FolderRec> list = ((IMailbox)this).EnumerateFolderHierarchy(EnumerateFolderHierarchyFlags.None, null);

            foreach (FolderRec folderRec in list)
            {
                if (folderRec.FolderType != FolderType.Search)
                {
                    using (MapiSourceFolder folder = base.GetFolder <MapiSourceFolder>(folderRec.EntryId))
                    {
                        if (folder == null)
                        {
                            MrsTracer.Provider.Debug("Folder {0} is missing in source while reading rules. Will sync its deletion later.", new object[]
                            {
                                TraceUtils.DumpEntryId(folderRec.EntryId)
                            });
                            break;
                        }
                        using (base.RHTracker.Start())
                        {
                            folder.Folder.GetRules(null);
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
 void IDestinationMailbox.DeleteFolder(FolderRec folderRec)
 {
     MrsTracer.Provider.Function("StorageDestinationMailbox.DeleteFolder(\"{0}\")", new object[]
     {
         folderRec.FolderName
     });
     base.VerifyMailboxConnection(VerifyMailboxConnectionFlags.None);
     using (base.RHTracker.Start())
     {
         using (CoreFolder coreFolder = CoreFolder.Bind(base.StoreSession, base.GetFolderId(folderRec.ParentId)))
         {
             GroupOperationResult groupOperationResult = coreFolder.DeleteFolder(DeleteFolderFlags.DeleteMessages | DeleteFolderFlags.DeleteSubFolders, StoreObjectId.FromProviderSpecificId(folderRec.EntryId));
             if (groupOperationResult.OperationResult != OperationResult.Succeeded)
             {
                 MrsTracer.Provider.Error("StorageDestinationMailbox.DeleteFolder failed with '{0}'. Folder name: '{1}', type: '{2}', entry id: '{3}'.", new object[]
                 {
                     groupOperationResult.Exception.ToString(),
                     folderRec.FolderName,
                     folderRec.FolderType,
                     TraceUtils.DumpEntryId(folderRec.EntryId)
                 });
                 groupOperationResult.Exception.PreserveExceptionStack();
                 throw groupOperationResult.Exception;
             }
         }
     }
 }
Exemplo n.º 5
0
 ISourceFolder ISourceMailbox.GetFolder(byte[] entryId)
 {
     MrsTracer.Provider.Function("PopSourceMailbox.GetFolder({0})", new object[]
     {
         TraceUtils.DumpEntryId(entryId)
     });
     return(base.GetFolder <PopSourceFolder>(entryId));
 }
Exemplo n.º 6
0
		IDestinationFolder IDestinationMailbox.GetFolder(byte[] entryId)
		{
			MrsTracer.Provider.Function("PstDestinationMailbox.GetFolder({0})", new object[]
			{
				TraceUtils.DumpEntryId(entryId)
			});
			return base.GetFolder<PstDestinationFolder>(entryId);
		}
Exemplo n.º 7
0
 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();
                         }
                     }
                 }
             }
         }
     });
 }
Exemplo n.º 8
0
 public override string ToString()
 {
     return(string.Format("{0}: EntryID: {1}, ParentID: {2}, Type: {3}", new object[]
     {
         this.FolderName,
         TraceUtils.DumpEntryId(this.EntryId),
         TraceUtils.DumpEntryId(this.ParentId),
         this.FolderType
     }));
 }
Exemplo n.º 9
0
        internal static List <MoveHistoryEntryInternal> LoadMoveHistory(MapiStore mailbox)
        {
            MrsTracer.Common.Function("MoveHistoryEntryInternal.LoadMoveHistory", new object[0]);
            List <MoveHistoryEntryInternal> list = new List <MoveHistoryEntryInternal>();

            using (MapiFolder mapiFolder = MapiUtils.OpenFolderUnderRoot(mailbox, MoveHistoryEntryInternal.MHEFolderName, false))
            {
                if (mapiFolder == null)
                {
                    return(list);
                }
                using (MapiTable contentsTable = mapiFolder.GetContentsTable(ContentsTableFlags.DeferredErrors))
                {
                    PropValue[][] array = MapiUtils.QueryAllRows(contentsTable, null, new PropTag[]
                    {
                        PropTag.EntryId
                    });
                    foreach (PropValue[] array3 in array)
                    {
                        byte[] bytes   = array3[0].GetBytes();
                        string subject = string.Format("MoveHistoryEntry {0}", TraceUtils.DumpEntryId(bytes));
                        MoveObjectInfo <MoveHistoryEntryInternal> moveObjectInfo = new MoveObjectInfo <MoveHistoryEntryInternal>(Guid.Empty, mailbox, bytes, MoveHistoryEntryInternal.MHEFolderName, MoveHistoryEntryInternal.MHEMessageClass, subject, null);
                        using (moveObjectInfo)
                        {
                            MoveHistoryEntryInternal moveHistoryEntryInternal = null;
                            try
                            {
                                moveHistoryEntryInternal = moveObjectInfo.ReadObject(ReadObjectFlags.DontThrowOnCorruptData);
                            }
                            catch (MailboxReplicationPermanentException ex)
                            {
                                MrsTracer.Common.Warning("Failed to read move history entry: {0}", new object[]
                                {
                                    ex.ToString()
                                });
                            }
                            if (moveHistoryEntryInternal != null)
                            {
                                list.Add(moveHistoryEntryInternal);
                            }
                            else if (moveObjectInfo.CreationTimestamp < DateTime.UtcNow - TimeSpan.FromDays(365.0))
                            {
                                MrsTracer.Common.Warning("Removing old corrupt MHEI entry {0}", new object[]
                                {
                                    TraceUtils.DumpEntryId(bytes)
                                });
                                moveObjectInfo.DeleteMessage();
                            }
                        }
                    }
                }
            }
            list.Sort();
            return(list);
        }
Exemplo n.º 10
0
 public override void ApplyContentsChanges(SyncContext ctx, MailboxChanges changes)
 {
     MrsTracer.Service.Function("MailboxMerger.ApplyContentsChanges", new object[0]);
     if (changes.HasFolderRecoverySync)
     {
         return;
     }
     foreach (FolderChangesManifest folderChangesManifest in changes.FolderChanges.Values)
     {
         FolderMapping folderMapping = (FolderMapping)this.SourceHierarchy[folderChangesManifest.FolderId];
         if (folderMapping == null)
         {
             MrsTracer.Service.Warning("Folder {0} is not discovered in source, will not apply changes", new object[]
             {
                 TraceUtils.DumpEntryId(folderChangesManifest.FolderId)
             });
             return;
         }
         using (ISourceFolder folder = base.SourceMailbox.GetFolder(folderMapping.EntryId))
         {
             if (folder == null)
             {
                 MrsTracer.Service.Warning("Folder {0} disappeared from source, will not apply changes", new object[]
                 {
                     TraceUtils.DumpEntryId(folderChangesManifest.FolderId)
                 });
                 return;
             }
             byte[] array = base.FolderIdTranslator.TranslateFolderId(folderChangesManifest.FolderId);
             if (array == null)
             {
                 MrsTracer.Service.Warning("Source folder {0} is not present in target mailbox, will not apply changes", new object[]
                 {
                     TraceUtils.DumpEntryId(folderChangesManifest.FolderId)
                 });
                 return;
             }
             using (IDestinationFolder folder2 = base.DestMailbox.GetFolder(array))
             {
                 if (folder2 == null)
                 {
                     MrsTracer.Service.Warning("Destination folder {0} disappeared, will not apply changes", new object[]
                     {
                         TraceUtils.DumpEntryId(array)
                     });
                     return;
                 }
                 this.ApplyFolderChanges(ctx, folderChangesManifest, folderMapping, folder, folder2);
             }
         }
     }
     base.ReportContentChangesSynced(ctx);
     base.ICSSyncState.ProviderState = base.SourceMailbox.GetMailboxSyncState();
     base.SaveICSSyncState(false);
 }
Exemplo n.º 11
0
        public T GetFolder <T>(byte[] folderId) where T : PopFolder, new()
        {
            MrsTracer.Provider.Function("PopMailbox.GetFolder({0})", new object[]
            {
                TraceUtils.DumpEntryId(folderId)
            });
            T result = Activator.CreateInstance <T>();

            result.Config(folderId, this);
            return(result);
        }
Exemplo n.º 12
0
 public override string ToString()
 {
     return(string.Concat(new string[]
     {
         base.ToString(),
         ", ItemId: ",
         TraceUtils.DumpEntryId(this.ItemId),
         ", PreviousItemId: ",
         TraceUtils.DumpEntryId(this.PreviousItemId)
     }));
 }
 void IDestinationMailbox.MoveFolder(byte[] folderId, byte[] oldParentId, byte[] newParentId)
 {
     base.CreateContext("IDestinationMailbox.MoveFolder", new DataContext[]
     {
         new EntryIDsDataContext(folderId),
         new SimpleValueDataContext("OldParentId", TraceUtils.DumpEntryId(oldParentId)),
         new SimpleValueDataContext("NewParentId", TraceUtils.DumpEntryId(newParentId))
     }).Execute(delegate
     {
         ((IDestinationMailbox)this.WrappedObject).MoveFolder(folderId, oldParentId, newParentId);
     }, true);
 }
Exemplo n.º 14
0
 public override string ToString()
 {
     return(string.Concat(new object[]
     {
         base.ToString(),
         ", EntryId: ",
         TraceUtils.DumpEntryId(base.ItemId),
         ", Data: [len=",
         this.Data.Length,
         "], Recipients: ",
         string.Join(",", this.Recipients)
     }));
 }
Exemplo n.º 15
0
 byte[] IEntryIdTranslator.GetSourceFolderIdFromTargetFolderId(byte[] targetFolderId)
 {
     ArgumentValidator.ThrowIfNull("targetFolderId", targetFolderId);
     byte[] array = this.Merger.FolderIdTranslator.TranslateTargetFolderId(targetFolderId);
     if (array == null)
     {
         MrsTracer.Service.Warning("Destination folder {0} doesn't have mapped source folder", new object[]
         {
             TraceUtils.DumpEntryId(targetFolderId)
         });
     }
     return(array);
 }
Exemplo n.º 16
0
        private void WriteEntryIdReference(PropTagFolderMapping ptfm, byte[] folderId, FolderHierarchy.GetPropsDelegate getProps, FolderHierarchy.SetPropsDelegate setProps)
        {
            InboxNamedPropFolderMapping inboxNamedPropFolderMapping = ptfm as InboxNamedPropFolderMapping;
            PropTag propTag;

            if (inboxNamedPropFolderMapping != null)
            {
                propTag = this.MbxWrapper.NamedPropMapper.MapNamedProp(inboxNamedPropFolderMapping.NamedPropData, PropType.Binary);
            }
            else
            {
                propTag = ptfm.Ptag;
            }
            MrsTracer.Service.Debug("Writing WKF reference {0}: {1} -> {2}", new object[]
            {
                ptfm.WKFType,
                propTag,
                TraceUtils.DumpEntryId(folderId)
            });
            InboxIndexedFolderMapping inboxIndexedFolderMapping = ptfm as InboxIndexedFolderMapping;
            object value;

            if (inboxIndexedFolderMapping != null)
            {
                List <byte[]>   list  = new List <byte[]>();
                PropValueData[] array = getProps(new PropTag[]
                {
                    propTag
                });
                byte[][] array2 = array[0].Value as byte[][];
                if (array2 != null)
                {
                    list.AddRange(array2);
                }
                while (list.Count < inboxIndexedFolderMapping.EntryIndex + 1)
                {
                    list.Add(Array <byte> .Empty);
                }
                list[inboxIndexedFolderMapping.EntryIndex] = folderId;
                value = list.ToArray();
            }
            else
            {
                value = folderId;
            }
            PropValueData[] pvda = new PropValueData[]
            {
                new PropValueData(propTag, value)
            };
            setProps(pvda);
        }
        IDestinationFolder IDestinationMailbox.GetFolder(byte[] entryId)
        {
            MrsTracer.Provider.Function("MapiDestinationMailbox.GetFolder({0})", new object[]
            {
                TraceUtils.DumpEntryId(entryId)
            });
            IDestinationFolder folder;

            using (base.RHTracker.Start())
            {
                folder = base.GetFolder <MapiDestinationFolder>(entryId);
            }
            return(folder);
        }
Exemplo n.º 18
0
 private void IdentifyDuplicateSecondaryKeys(MessageRec message, List <byte[]> secondaryKeys, HashSet <byte[]> uniqueSecondaryKeys, HashSet <byte[]> duplicateSecondaryKeys)
 {
     foreach (byte[] array in secondaryKeys)
     {
         if (array != null && !duplicateSecondaryKeys.Contains(array) && !uniqueSecondaryKeys.Add(array))
         {
             MrsTracer.Service.Debug("Duplicate secondary key found for source message {0}", new object[]
             {
                 TraceUtils.DumpEntryId(message.EntryId)
             });
             uniqueSecondaryKeys.Remove(array);
             duplicateSecondaryKeys.Add(array);
         }
     }
 }
Exemplo n.º 19
0
        ISourceFolder ISourceMailbox.GetFolder(byte[] entryId)
        {
            MrsTracer.ProxyClient.Function("RemoteSourceMailbox.GetFolder({0})", new object[]
            {
                TraceUtils.DumpEntryId(entryId)
            });
            base.VerifyMailboxConnection();
            long num = base.MrsProxy.ISourceMailbox_GetFolder(base.Handle, entryId);

            if (num == 0L)
            {
                return(null);
            }
            return(new RemoteSourceFolder(base.MrsProxy, num, entryId, this));
        }
Exemplo n.º 20
0
        public void PrefetchSourceMessageIdsFromTargetMessageIds(EntryIdMap <List <byte[]> > destMessagesToTranslate)
        {
            this.prefetchedSourceEntryIdMap.Clear();
            PropTag sourceEntryIDPtag = this.Merger.DestHierarchy.SourceEntryIDPtag;

            PropTag[] additionalPtagsToLoad = new PropTag[]
            {
                sourceEntryIDPtag
            };
            foreach (KeyValuePair <byte[], List <byte[]> > keyValuePair in destMessagesToTranslate)
            {
                byte[]        key   = keyValuePair.Key;
                List <byte[]> value = keyValuePair.Value;
                foreach (byte[] key2 in value)
                {
                    this.prefetchedSourceEntryIdMap[key2] = null;
                }
                using (IDestinationFolder folder = this.Merger.DestMailbox.GetFolder(key))
                {
                    if (folder == null)
                    {
                        MrsTracer.Service.Warning("Destination folder {0} disappeared", new object[]
                        {
                            TraceUtils.DumpEntryId(key)
                        });
                    }
                    else
                    {
                        List <MessageRec> list = folder.LookupMessages(PropTag.EntryId, value, additionalPtagsToLoad);
                        foreach (MessageRec messageRec in list)
                        {
                            byte[] array = messageRec[sourceEntryIDPtag] as byte[];
                            if (array == null)
                            {
                                MrsTracer.Service.Warning("Destination message {0} doesn't have mapped source message", new object[]
                                {
                                    TraceUtils.DumpEntryId(messageRec.EntryId)
                                });
                            }
                            else
                            {
                                this.prefetchedSourceEntryIdMap[messageRec.EntryId] = array;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 21
0
 internal void TranslateFolderId(IEntryIdTranslator translator)
 {
     byte[] folderId = this.FolderId;
     byte[] sourceFolderIdFromTargetFolderId = translator.GetSourceFolderIdFromTargetFolderId(folderId);
     if (sourceFolderIdFromTargetFolderId == null)
     {
         MrsTracer.Common.Warning("Destination folder {0} doesn't have mapped source folder for action {1}", new object[]
         {
             TraceUtils.DumpEntryId(folderId),
             this
         });
         this.Ignored = true;
     }
     this.OriginalFolderId = folderId;
     this.FolderId         = sourceFolderIdFromTargetFolderId;
 }
Exemplo n.º 22
0
 internal void TranslateEntryId(IEntryIdTranslator translator)
 {
     byte[] itemId = this.ItemId;
     byte[] sourceMessageIdFromTargetMessageId = translator.GetSourceMessageIdFromTargetMessageId(itemId);
     if (sourceMessageIdFromTargetMessageId == null)
     {
         MrsTracer.Common.Warning("Destination message {0} doesn't have mapped source message for action {1}", new object[]
         {
             TraceUtils.DumpEntryId(itemId),
             this
         });
         this.Ignored = true;
     }
     this.OriginalItemId = itemId;
     this.ItemId         = sourceMessageIdFromTargetMessageId;
 }
Exemplo n.º 23
0
 internal override void TranslateEntryIds(IEntryIdTranslator translator)
 {
     base.TranslateEntryIds(translator);
     byte[] previousFolderId = this.PreviousFolderId;
     byte[] sourceFolderIdFromTargetFolderId = translator.GetSourceFolderIdFromTargetFolderId(previousFolderId);
     if (sourceFolderIdFromTargetFolderId == null)
     {
         MrsTracer.Common.Warning("Previous destination folder {0} doesn't have mapped source folder for action {1}", new object[]
         {
             TraceUtils.DumpEntryId(previousFolderId),
             this
         });
         base.Ignored = true;
     }
     this.PreviousFolderId = sourceFolderIdFromTargetFolderId;
 }
Exemplo n.º 24
0
 private void ExportSingleFolder(IFxProxyPool proxyPool, byte[] folderEntryId, ExportFoldersDataToCopyFlags exportFoldersDataToCopyFlags, GetFolderRecFlags folderRecFlags, PropTag[] additionalFolderRecProps, CopyPropertiesFlags copyPropertiesFlags, PropTag[] excludePropertiesFromCopy, AclFlags extendedAclFlags)
 {
     ExecutionContext.Create(new DataContext[]
     {
         new OperationDataContext("StorageSourceMailbox.ExportSingleFolder", OperationType.None),
         new EntryIDsDataContext(folderEntryId),
         new SimpleValueDataContext("exportFoldersDataToCopyFlags", exportFoldersDataToCopyFlags),
         new SimpleValueDataContext("folderRecFlags", folderRecFlags),
         new PropTagsDataContext(additionalFolderRecProps),
         new SimpleValueDataContext("copyPropertiesFlags", copyPropertiesFlags),
         new PropTagsDataContext(excludePropertiesFromCopy),
         new SimpleValueDataContext("extendedAclFlags", extendedAclFlags)
     }).Execute(delegate
     {
         using (this.RHTracker.Start())
         {
             using (ISourceFolder folder = this.GetFolder <StorageSourceFolder>(folderEntryId))
             {
                 if (folder == null)
                 {
                     MrsTracer.Provider.Debug("Folder {0} is missing in source. Skipping.", new object[]
                     {
                         TraceUtils.DumpEntryId(folderEntryId)
                     });
                 }
                 else
                 {
                     using (IFolderProxy folderProxyForExportFolder = StorageSourceMailbox.GetFolderProxyForExportFolder(proxyPool, folder, exportFoldersDataToCopyFlags, folderRecFlags, additionalFolderRecProps))
                     {
                         if (extendedAclFlags != AclFlags.None)
                         {
                             this.ExportExtendedAcls(extendedAclFlags, folder, folderProxyForExportFolder);
                         }
                         using (FxProxyBudgetWrapper fxProxyBudgetWrapper = new FxProxyBudgetWrapper(folderProxyForExportFolder, false, new Func <IDisposable>(this.RHTracker.StartExclusive), new Action <uint>(this.RHTracker.Charge)))
                         {
                             if (exportFoldersDataToCopyFlags.HasFlag(ExportFoldersDataToCopyFlags.IncludeCopyToStream))
                             {
                                 folder.CopyTo(fxProxyBudgetWrapper, copyPropertiesFlags, excludePropertiesFromCopy);
                             }
                         }
                     }
                 }
             }
         }
     });
 }
        public override string ToString()
        {
            switch (this.folderRecWrapper.FolderType)
            {
            case FolderType.Root:
                return(string.Format("Root folder: entryId {0}", TraceUtils.DumpEntryId(this.folderRecWrapper.EntryId)));

            case FolderType.Generic:
                return(string.Format("Folder: '{0}', entryId {1}, parentId {2}", this.folderRecWrapper.FullFolderName, TraceUtils.DumpEntryId(this.folderRecWrapper.EntryId), TraceUtils.DumpEntryId(this.folderRecWrapper.ParentId)));

            case FolderType.Search:
                return(string.Format("Search folder: '{0}', entryId {1}, parentId {2}", this.folderRecWrapper.FullFolderName, TraceUtils.DumpEntryId(this.folderRecWrapper.EntryId), TraceUtils.DumpEntryId(this.folderRecWrapper.ParentId)));

            default:
                return(string.Format("Folder: entryId {0}", TraceUtils.DumpEntryId(this.folderRecWrapper.EntryId)));
            }
        }
Exemplo n.º 26
0
 private void UpdateSourceId(byte[] destinationFolderId, byte[] destinationMessageId, byte[] sourceId)
 {
     using (IDestinationFolder folder = base.DestMailbox.GetFolder(destinationFolderId))
     {
         if (folder == null)
         {
             MrsTracer.Service.Warning("Destination folder {0} disappeared", new object[]
             {
                 TraceUtils.DumpEntryId(destinationFolderId)
             });
         }
         else
         {
             folder.SetMessageProps(destinationMessageId, new PropValueData[]
             {
                 new PropValueData(this.DestHierarchy.SourceEntryIDPtag, sourceId)
             });
         }
     }
 }
Exemplo n.º 27
0
 private void DeleteItem(byte[] destinationFolderId, byte[] destinationMessageId)
 {
     using (IDestinationFolder folder = base.DestMailbox.GetFolder(destinationFolderId))
     {
         if (folder == null)
         {
             MrsTracer.Service.Warning("Destination folder {0} disappeared", new object[]
             {
                 TraceUtils.DumpEntryId(destinationFolderId)
             });
         }
         else
         {
             folder.DeleteMessages(new byte[][]
             {
                 destinationMessageId
             });
         }
     }
 }
Exemplo n.º 28
0
        public T GetFolder <T>(byte[] folderId) where T : PstFolder, new()
        {
            MrsTracer.Provider.Function("PstMailbox.GetFolder({0})", new object[]
            {
                TraceUtils.DumpEntryId(folderId)
            });
            uint    nodeIdFromEntryId = PstMailbox.GetNodeIdFromEntryId(this.iPst.MessageStore.Guid, folderId);
            IFolder folder;

            try
            {
                folder = this.iPst.ReadFolder(nodeIdFromEntryId);
            }
            catch (PSTIOException innerException)
            {
                throw new UnableToReadPSTFolderTransientException(nodeIdFromEntryId, innerException);
            }
            catch (PSTExceptionBase innerException2)
            {
                throw new UnableToReadPSTFolderPermanentException(nodeIdFromEntryId, innerException2);
            }
            if (folder == null)
            {
                MrsTracer.Provider.Debug("Folder does not exist", new object[0]);
                return(default(T));
            }
            PstFxFolder pstFxFolder = new PstFxFolder(this, folder);

            if (MrsTracer.Provider.IsEnabled(TraceType.DebugTrace))
            {
                MrsTracer.Provider.Debug("Opened folder '{0}'", new object[]
                {
                    (string)pstFxFolder.GetProp(PropertyTag.DisplayName).Value
                });
            }
            T result = Activator.CreateInstance <T>();

            result.Config(folderId, pstFxFolder);
            return(result);
        }
Exemplo n.º 29
0
        public T GetFolder <T>(byte[] folderId) where T : ImapFolder, new()
        {
            MrsTracer.Provider.Function("ImapMailbox.GetFolder({0})", new object[]
            {
                TraceUtils.DumpEntryId(folderId)
            });
            base.VerifyMailboxConnection(VerifyMailboxConnectionFlags.None);
            ImapClientFolder folder;

            if (!this.folderCache.TryGetValue(folderId, out folder))
            {
                MrsTracer.Provider.Debug("Folder with entryId {0} does not exist", new object[]
                {
                    folderId
                });
                return(default(T));
            }
            T result = Activator.CreateInstance <T>();

            result.Config(folderId, folder, this);
            return(result);
        }
Exemplo n.º 30
0
        public void CopyMailboxProperties()
        {
            MrsTracer.Service.Function("MailboxMerger.CopyMailboxProperties", new object[0]);
            PropValue[] native = DataConverter <PropValueConverter, PropValue, PropValueData> .GetNative(base.SourceMailbox.GetProps(MailboxMerger.MailboxPtags));

            List <PropValue> list = new List <PropValue>();

            foreach (PropValue item in native)
            {
                if (!item.IsNull() && !item.IsError())
                {
                    if (item.PropTag == PropTag.SentMailEntryId)
                    {
                        byte[] array2 = item.Value as byte[];
                        if (array2 != null)
                        {
                            FolderMapping folderMapping = this.SourceHierarchy[array2] as FolderMapping;
                            if (folderMapping != null && folderMapping.IsIncluded && folderMapping.TargetFolder != null)
                            {
                                MrsTracer.Service.Debug("Remapped SentItemsEntryId from {0} to {1}", new object[]
                                {
                                    TraceUtils.DumpEntryId(array2),
                                    TraceUtils.DumpEntryId(folderMapping.TargetFolder.EntryId)
                                });
                                list.Add(new PropValue(item.PropTag, folderMapping.TargetFolder.EntryId));
                            }
                        }
                    }
                    else
                    {
                        list.Add(item);
                    }
                }
            }
            if (list.Count > 0)
            {
                base.DestMailbox.SetProps(DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(list.ToArray()));
            }
        }