// Token: 0x0600045E RID: 1118 RVA: 0x0001F4F4 File Offset: 0x0001D6F4
        internal FolderTuple[] GetTargetFolderPathFromSourceFolder(StoreObjectId sourceFolderId)
        {
            List <FolderTuple> list = new List <FolderTuple>();

            if (this.mailboxHierarchy == null)
            {
                this.mailboxHierarchy = FolderHelper.QueryFolderHierarchy(this.MailboxSession);
            }
            StoreObjectId key = sourceFolderId;

            while (key != null)
            {
                FolderTuple folderTuple = null;
                bool        flag        = this.mailboxHierarchy.TryGetValue(key, out folderTuple);
                if (!flag || string.IsNullOrEmpty(folderTuple.DisplayName))
                {
                    break;
                }
                list.Insert(0, folderTuple);
                key = null;
                if (!ArrayComparer <byte> .Comparer.Equals(folderTuple.FolderId.ProviderLevelItemId, folderTuple.ParentId.ProviderLevelItemId))
                {
                    key = folderTuple.ParentId;
                }
            }
            return(list.ToArray());
        }
 // Token: 0x06000525 RID: 1317 RVA: 0x00026EB8 File Offset: 0x000250B8
 private void AssignTagPropsToFolder(FolderTuple source, FolderTupleCrossServerArchive target, Folder targetFolder, bool update)
 {
     for (FolderHelper.DataColumnIndex dataColumnIndex = FolderHelper.DataColumnIndex.startOfTagPropsIndex; dataColumnIndex <= FolderHelper.DataColumnIndex.containerClassIndex; dataColumnIndex++)
     {
         PropertyDefinition         key = FolderHelper.DataColumns[(int)dataColumnIndex];
         ExtendedPropertyDefinition extendedPropertyDefinition = this.EwsStorePropertyMapping[key];
         object obj  = source.FolderProps[key];
         object obj2 = target.FolderProps[key];
         if (obj != null && !(obj is PropertyError))
         {
             string text = obj as string;
             if (text == null || !string.IsNullOrEmpty(text))
             {
                 targetFolder.SetExtendedProperty(extendedPropertyDefinition, obj);
             }
         }
         else if (obj2 != null)
         {
             targetFolder.RemoveExtendedProperty(extendedPropertyDefinition);
         }
     }
     if (update)
     {
         this.EwsDataProvider.UpdateFolder(targetFolder);
         RemoteArchiveProcessor.Tracer.TraceDebug(0L, "AssignedTagPropsToFolder.");
     }
 }
Пример #3
0
        // Token: 0x06000475 RID: 1141 RVA: 0x00020064 File Offset: 0x0001E264
        internal static void AssignTagPropsToFolder(FolderTuple source, Folder target, MailboxSession session)
        {
            StoreObjectId objectId = target.Id.ObjectId;

            for (FolderHelper.DataColumnIndex dataColumnIndex = FolderHelper.DataColumnIndex.startOfTagPropsIndex; dataColumnIndex <= FolderHelper.DataColumnIndex.containerClassIndex; dataColumnIndex++)
            {
                PropertyDefinition key = FolderHelper.DataColumns[(int)dataColumnIndex];
                object             obj = source.FolderProps[key];
                if (obj != null && !(obj is PropertyError))
                {
                    if (dataColumnIndex != FolderHelper.DataColumnIndex.containerClassIndex)
                    {
                        target[FolderHelper.DataColumns[(int)dataColumnIndex]] = obj;
                    }
                    else if (target.GetValueOrDefault <string>(FolderHelper.DataColumns[(int)dataColumnIndex], null) == null)
                    {
                        target[FolderHelper.DataColumns[(int)dataColumnIndex]] = obj;
                    }
                }
                else if (target.GetValueOrDefault <object>(FolderHelper.DataColumns[(int)dataColumnIndex]) != null && dataColumnIndex != FolderHelper.DataColumnIndex.containerClassIndex)
                {
                    target.DeleteProperties(new PropertyDefinition[]
                    {
                        FolderHelper.DataColumns[(int)dataColumnIndex]
                    });
                }
            }
            FolderSaveResult folderSaveResult = target.Save();

            if (folderSaveResult.OperationResult != OperationResult.Succeeded)
            {
                FolderTuple.Tracer.TraceError <StoreObjectId, FolderSaveResult>(0L, "AssignTagPropsToFolder for folder {0} save result {1}", objectId, folderSaveResult);
                throw new IWPermanentException(Strings.descUnableToSaveFolderTagProperties(objectId.ToString(), session.MailboxOwner.ToString(), folderSaveResult.ToString()));
            }
        }
Пример #4
0
 // Token: 0x06000474 RID: 1140 RVA: 0x0001FF6C File Offset: 0x0001E16C
 internal static bool ArePropTagsSame(FolderTuple left, FolderTuple right)
 {
     for (FolderHelper.DataColumnIndex dataColumnIndex = FolderHelper.DataColumnIndex.startOfTagPropsIndex; dataColumnIndex <= FolderHelper.DataColumnIndex.containerClassIndex; dataColumnIndex++)
     {
         PropertyDefinition propertyDefinition = FolderHelper.DataColumns[(int)dataColumnIndex];
         object             obj  = left.FolderProps[propertyDefinition];
         object             obj2 = right.FolderProps[propertyDefinition];
         bool flag  = obj != null && !(obj is PropertyError);
         bool flag2 = obj2 != null && !(obj2 is PropertyError);
         if (flag && flag2)
         {
             if (propertyDefinition == StoreObjectSchema.PolicyTag || propertyDefinition == StoreObjectSchema.ArchiveTag || propertyDefinition == FolderSchema.RetentionTagEntryId)
             {
                 if (!(obj is byte[]) || !(obj2 is byte[]) || !ArrayComparer <byte> .Comparer.Equals((byte[])obj, (byte[])obj2))
                 {
                     return(false);
                 }
             }
             else if ((propertyDefinition == StoreObjectSchema.RetentionPeriod || propertyDefinition == StoreObjectSchema.RetentionFlags || propertyDefinition == StoreObjectSchema.ArchivePeriod) && (!(obj is int) || !(obj2 is int) || (int)obj != (int)obj2))
             {
                 return(false);
             }
         }
         else if (flag ^ flag2)
         {
             return(false);
         }
     }
     return(true);
 }
Пример #5
0
 // Token: 0x06000476 RID: 1142 RVA: 0x0002015D File Offset: 0x0001E35D
 internal void AddChild(string childName, FolderTuple childTuple)
 {
     if (this.children == null)
     {
         this.children = new Dictionary <string, FolderTuple>(StringComparer.OrdinalIgnoreCase);
     }
     this.children[childName ?? string.Empty] = childTuple;
 }
 // Token: 0x06000510 RID: 1296 RVA: 0x000264D0 File Offset: 0x000246D0
 public void UpdatePropertiesOnFolderInArchive(FolderTuple source, FolderTuple target)
 {
     if (this.archiveMailboxSession == null)
     {
         LocalArchiveProcessor.Tracer.TraceWarning <LocalArchiveProcessor>((long)this.GetHashCode(), "{0}: Could not open archive session for this mailbox", this);
     }
     using (Folder folder = Folder.Bind(this.archiveMailboxSession, target.FolderId, FolderHelper.DataColumns))
     {
         FolderTuple.AssignTagPropsToFolder(source, folder, this.archiveMailboxSession);
     }
 }
Пример #7
0
 // Token: 0x06000477 RID: 1143 RVA: 0x00020190 File Offset: 0x0001E390
 internal bool TryGetChild(string childName, out FolderTuple child)
 {
     child = null;
     FolderTuple.Tracer.TraceDebug <string, string>((long)this.GetHashCode(), "Looking for child '{0}' under '{1}'.", childName, this.DisplayName);
     if (this.Children != null)
     {
         FolderTuple.Tracer.TraceDebug <string>((long)this.GetHashCode(), "Folder '{0}' has children. Will look for a match.", this.DisplayName);
         return(this.Children.TryGetValue(childName, out child));
     }
     FolderTuple.Tracer.TraceDebug <string, string>((long)this.GetHashCode(), "No child called '{0}' was found under folder '{1}'.", childName, this.DisplayName);
     return(false);
 }
 // Token: 0x0600050D RID: 1293 RVA: 0x00025F00 File Offset: 0x00024100
 public void MoveToArchive(TagExpirationExecutor.ItemSet itemSet, ElcSubAssistant assistant, FolderArchiver folderArchiver, int totalFailuresSoFar, ref List <Exception> allExceptionsSoFar, out List <string> foldersWithErrors, out int newMoveErrorsTotal)
 {
     if (itemSet == null)
     {
         throw new ArgumentNullException("itemSet");
     }
     if (assistant == null)
     {
         throw new ArgumentNullException("assistant");
     }
     if (folderArchiver == null)
     {
         throw new ArgumentNullException("folderArchiver");
     }
     foldersWithErrors  = new List <string>();
     newMoveErrorsTotal = 0;
     if (this.archiveMailboxSession == null)
     {
         LocalArchiveProcessor.Tracer.TraceWarning <LocalArchiveProcessor>((long)this.GetHashCode(), "{0}: Could not open archive session for this mailbox", this);
         return;
     }
     assistant.EnableLoadTrackingOnSession(this.archiveMailboxSession);
     using (Folder folder = Folder.Bind(this.primaryMailboxSession, itemSet.FolderId))
     {
         if (folder != null)
         {
             FolderTuple archiveFolderTuple = folderArchiver.GetArchiveFolderTuple(folder.Id.ObjectId);
             if (archiveFolderTuple != null)
             {
                 using (Folder folder2 = Folder.Bind(this.archiveMailboxSession, archiveFolderTuple.FolderId))
                 {
                     if (folder2 != null)
                     {
                         LocalArchiveProcessor.Tracer.TraceDebug <LocalArchiveProcessor, string, string>((long)this.GetHashCode(), "{0}: Was able to open target folder {1} in the archive, corresponding to source folder {2}. Will proceed to move in batches.", this, folder2.DisplayName, folder.DisplayName);
                         this.ExpireInBatches(itemSet.Items, folder, folder2, assistant, ExpirationExecutor.Action.MoveToArchive, totalFailuresSoFar, ref allExceptionsSoFar, out foldersWithErrors, out newMoveErrorsTotal);
                     }
                     else
                     {
                         LocalArchiveProcessor.Tracer.TraceWarning <LocalArchiveProcessor, string>((long)this.GetHashCode(), "{0}: Unable to open target folder in the archive corresponding to source folder {1}. Will not move anything to it (obviously).", this, folder.DisplayName);
                     }
                     goto IL_14B;
                 }
             }
             LocalArchiveProcessor.Tracer.TraceWarning <LocalArchiveProcessor, string>((long)this.GetHashCode(), "{0}: Unable to get target folder in the archive corresponding to source folder {1}. Will not move anything to it (obviously).", this, folder.DisplayName);
         }
         else
         {
             LocalArchiveProcessor.Tracer.TraceWarning <LocalArchiveProcessor, string>((long)this.GetHashCode(), "{0}: Unable to open source folder {1}. Will not move anything from it (obviously).", this, itemSet.FolderId.ToHexEntryId());
         }
         IL_14B :;
     }
 }
        // Token: 0x06000522 RID: 1314 RVA: 0x00026C80 File Offset: 0x00024E80
        public FolderTuple CreateAndUpdateFolderInArchive(FolderTuple parentInArchive, FolderTuple sourceInPrimary)
        {
            FolderTupleCrossServerArchive folderTupleCrossServerArchive = (FolderTupleCrossServerArchive)parentInArchive;
            Folder folder = new Folder(this.EwsDataProvider.Service);

            folder.DisplayName = sourceInPrimary.DisplayName;
            FolderTupleCrossServerArchive folderTupleCrossServerArchive2 = new FolderTupleCrossServerArchive(folder, folder.Id, folderTupleCrossServerArchive.EwsFolderId, folder.DisplayName, this.ConvertToFolderProps(null));

            this.AssignTagPropsToFolder(sourceInPrimary, folderTupleCrossServerArchive2, folderTupleCrossServerArchive2.Folder, false);
            this.EwsDataProvider.SaveFolder(folder, folderTupleCrossServerArchive.EwsFolderId);
            folderTupleCrossServerArchive2.EwsFolderId = folder.Id;
            return(folderTupleCrossServerArchive2);
        }
Пример #10
0
        // Token: 0x06000465 RID: 1125 RVA: 0x0001FB30 File Offset: 0x0001DD30
        internal static FolderTuple LinkChildren(Dictionary <StoreObjectId, FolderTuple> folders, string emailAddress)
        {
            FolderTuple folderTuple  = null;
            FolderTuple folderTuple2 = null;

            FolderHelper.Tracer.TraceDebug <string>(0L, "{0}: LinkChildren: About to start linking children to parents.", emailAddress);
            foreach (FolderTuple folderTuple3 in folders.Values)
            {
                FolderHelper.Tracer.TraceDebug <string, string, string>(0L, "{0}: LinkChildren: About to link folder '{1}'. FolderId: '{2}'. Looking for parent..", emailAddress, folderTuple3.DisplayName, folderTuple3.FolderId.ToHexEntryId());
                if (folderTuple3.IsRootFolder || ArrayComparer <byte> .Comparer.Equals(folderTuple3.FolderId.ProviderLevelItemId, folderTuple3.ParentId.ProviderLevelItemId))
                {
                    if (folderTuple != null)
                    {
                        FolderHelper.Tracer.TraceError(0L, "{0}: LinkChildren: FolderId and ParentId of folder '{1}' are the same. FolderId: '{2}'. ParentId: '{3}'.", new object[]
                        {
                            emailAddress,
                            folderTuple3.DisplayName,
                            folderTuple3.FolderId.ToHexEntryId(),
                            folderTuple3.ParentId.ToHexEntryId()
                        });
                    }
                    else
                    {
                        FolderHelper.Tracer.TraceDebug(0L, "{0}: LinkChildren: Found root folder '{1}'. FolderId: '{2}'. ParentId: '{3}'.", new object[]
                        {
                            emailAddress,
                            folderTuple3.DisplayName,
                            folderTuple3.FolderId.ToHexEntryId(),
                            folderTuple3.ParentId.ToHexEntryId()
                        });
                        folderTuple = folderTuple3;
                    }
                }
                else if (folders.TryGetValue(folderTuple3.ParentId, out folderTuple2))
                {
                    folderTuple2.AddChild(folderTuple3.DisplayName, folderTuple3);
                    FolderHelper.Tracer.TraceDebug <string, string, string>(0L, "{0}: LinkChildren: Adding child folder {1} to parent folder {2}.", emailAddress, folderTuple3.DisplayName, folderTuple2.DisplayName);
                }
                else
                {
                    FolderHelper.Tracer.TraceDebug(0L, "{0}: LinkChildren: Could not find parent for folder {1} in table. FolderId: '{2}'. ParentId: '{3}'.", new object[]
                    {
                        emailAddress,
                        folderTuple3.DisplayName,
                        folderTuple3.FolderId.ToHexEntryId(),
                        folderTuple3.ParentId.ToHexEntryId()
                    });
                }
            }
            return(folderTuple);
        }
        // Token: 0x0600045C RID: 1116 RVA: 0x0001F1B8 File Offset: 0x0001D3B8
        internal FolderTuple GetArchiveFolderTuple(StoreObjectId sourceFolderId)
        {
            FolderTuple folderTuple  = null;
            FolderTuple folderTuple2 = null;

            FolderTuple[]     targetFolderPathFromSourceFolder = this.GetTargetFolderPathFromSourceFolder(sourceFolderId);
            DefaultFolderType defaultFolderType;

            if (this.ElcUserInformation.ProcessEhaMigratedMessages && (targetFolderPathFromSourceFolder == null || targetFolderPathFromSourceFolder.Length == 0) && this.IsMigrationFolder(sourceFolderId, out defaultFolderType))
            {
                StoreObjectId defaultFolderId = this.MailboxSession.GetDefaultFolderId(defaultFolderType);
                targetFolderPathFromSourceFolder = this.GetTargetFolderPathFromSourceFolder(defaultFolderId);
            }
            this.QueryHierarchies();
            if (this.archiveParent != null && this.archiveHierarchy != null && targetFolderPathFromSourceFolder != null && targetFolderPathFromSourceFolder.Length > 0)
            {
                folderTuple = this.archiveParent;
                FolderTuple folderTuple3 = null;
                foreach (FolderTuple folderTuple4 in targetFolderPathFromSourceFolder)
                {
                    FolderArchiver.Tracer.TraceDebug <IExchangePrincipal, string>((long)this.GetHashCode(), "{0}: GetArchiveFolder: The current pathPart in sourceFolderPath is {1}", this.mailboxSession.MailboxOwner, folderTuple4.DisplayName);
                    if (folderTuple.TryGetChild(folderTuple4.DisplayName, out folderTuple3))
                    {
                        FolderArchiver.Tracer.TraceDebug <IExchangePrincipal, string, string>((long)this.GetHashCode(), "{0}: GetArchiveFolder: The current source folder {1} was found in archive. Current folder in archive is {2}.", this.mailboxSession.MailboxOwner, folderTuple4.DisplayName, folderTuple.DisplayName);
                        folderTuple = folderTuple3;
                    }
                    else
                    {
                        FolderArchiver.Tracer.TraceDebug <IExchangePrincipal, string, string>((long)this.GetHashCode(), "{0}: GetArchiveFolder: The current source folder {1} was not found in archive. Current folder in archive is {2}.", this.mailboxSession.MailboxOwner, folderTuple4.DisplayName, folderTuple.DisplayName);
                        folderTuple2 = this.archiveProcessor.CreateAndUpdateFolderInArchive(folderTuple, folderTuple4);
                        if (!this.archiveHierarchy.ContainsKey(folderTuple2.FolderId))
                        {
                            FolderArchiver.Tracer.TraceDebug <IExchangePrincipal, string, string>((long)this.GetHashCode(), "{0}: GetArchiveFolder: The current source folder {1} was not found in archiveHierarchy table. Adding it to table. Id of corresp folder in archive: {2}", this.mailboxSession.MailboxOwner, folderTuple4.DisplayName, folderTuple2.FolderId.ToHexEntryId());
                            this.archiveHierarchy.Add(folderTuple2.FolderId, folderTuple2);
                        }
                        else
                        {
                            FolderArchiver.Tracer.TraceDebug <IExchangePrincipal, string, string>((long)this.GetHashCode(), "{0}: GetArchiveFolder: The current source folder {1} was already present in archiveHierarchy table. Id of corresp folder in archive: {2}", this.mailboxSession.MailboxOwner, folderTuple4.DisplayName, folderTuple2.FolderId.ToHexEntryId());
                            folderTuple2 = this.archiveHierarchy[folderTuple2.FolderId];
                        }
                        folderTuple.AddChild(folderTuple4.DisplayName, folderTuple2);
                        folderTuple = folderTuple2;
                    }
                }
            }
            if (folderTuple2 == null && folderTuple != null)
            {
                return(folderTuple);
            }
            return(folderTuple2);
        }
        // Token: 0x06000511 RID: 1297 RVA: 0x0002653C File Offset: 0x0002473C
        public FolderTuple CreateAndUpdateFolderInArchive(FolderTuple parentInArchive, FolderTuple sourceInPrimary)
        {
            FolderTuple result = null;

            using (Folder folder = Folder.Create(this.archiveMailboxSession, parentInArchive.FolderId, StoreObjectType.Folder, sourceInPrimary.DisplayName, CreateMode.OpenIfExists))
            {
                folder.Save();
                folder.Load(FolderHelper.DataColumns);
                FolderTuple.AssignTagPropsToFolder(sourceInPrimary, folder, this.archiveMailboxSession);
                folder.Load(FolderHelper.DataColumns);
                result = new FolderTuple(folder.Id.ObjectId, folder.ParentId, sourceInPrimary.DisplayName, sourceInPrimary.FolderProps);
            }
            return(result);
        }
Пример #13
0
        // Token: 0x06000464 RID: 1124 RVA: 0x0001F97C File Offset: 0x0001DB7C
        internal static Dictionary <StoreObjectId, FolderTuple> QueryFolderHierarchy(MailboxSession mailboxSession)
        {
            Dictionary <StoreObjectId, FolderTuple> dictionary = new Dictionary <StoreObjectId, FolderTuple>();

            if (mailboxSession == null)
            {
                return(dictionary);
            }
            FolderHelper.Tracer.TraceDebug <IExchangePrincipal, bool>((long)mailboxSession.GetHashCode(), "{0}: QueryFolderHierarchy: Archive mailbox: {1}.", mailboxSession.MailboxOwner, mailboxSession.MailboxOwner.MailboxInfo.IsArchive);
            StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Root);

            dictionary[defaultFolderId] = new FolderTuple(defaultFolderId, defaultFolderId, string.Empty, new object[10], true);
            using (Folder folder = Folder.Bind(mailboxSession, defaultFolderId))
            {
                using (QueryResult queryResult = folder.FolderQuery(FolderQueryFlags.DeepTraversal, null, null, FolderHelper.DataColumns))
                {
                    for (;;)
                    {
                        object[][] rows = queryResult.GetRows(100);
                        if (rows.Length <= 0)
                        {
                            break;
                        }
                        for (int i = 0; i < rows.Length; i++)
                        {
                            if (rows[i][0] is VersionedId && rows[i][1] is StoreObjectId)
                            {
                                StoreObjectId objectId      = (rows[i][0] as VersionedId).ObjectId;
                                StoreObjectId storeObjectId = rows[i][1] as StoreObjectId;
                                dictionary[objectId] = new FolderTuple(objectId, storeObjectId, (string)rows[i][2], rows[i]);
                                FolderHelper.Tracer.TraceDebug((long)mailboxSession.GetHashCode(), "{0}: QueryFolderHierarchy: Added folder '{1}' to the folderMap. FolderId: '{2}'. ParentId: '{3}'.", new object[]
                                {
                                    mailboxSession.MailboxOwner,
                                    (string)rows[i][2],
                                    objectId.ToHexEntryId(),
                                    storeObjectId.ToHexEntryId()
                                });
                            }
                        }
                    }
                }
            }
            return(dictionary);
        }
Пример #14
0
        // Token: 0x06000463 RID: 1123 RVA: 0x0001F7CC File Offset: 0x0001D9CC
        internal static void SyncFolders(IArchiveProcessor archiveHandler, FolderTuple sourceRoot, FolderTuple targetRoot, string traceId)
        {
            FolderHelper.< > c__DisplayClass2 CS$ < > 8__locals1 = new FolderHelper.< > c__DisplayClass2();
            CS$ < > 8__locals1.archiveHandler = archiveHandler;
            CS$ < > 8__locals1.traceId        = traceId;
            if (CS$ < > 8__locals1.archiveHandler == null)
            {
                return;
            }
            Queue <FolderTuple> queue  = new Queue <FolderTuple>(20);
            Queue <FolderTuple> queue2 = new Queue <FolderTuple>(20);

            queue.Enqueue(sourceRoot);
            queue2.Enqueue(targetRoot);
            while (queue2.Count > 0)
            {
                FolderHelper.< > c__DisplayClass6 CS$ < > 8__locals2 = new FolderHelper.< > c__DisplayClass6();
                CS$ < > 8__locals2.CS$ < > 8__locals3 = CS$ < > 8__locals1;
                CS$ < > 8__locals2.source             = queue.Dequeue();
                CS$ < > 8__locals2.target             = queue2.Dequeue();
                if (!FolderTuple.ArePropTagsSame(CS$ < > 8__locals2.source, CS$ < > 8__locals2.target))
                {
                    ILUtil.DoTryFilterCatch(new TryDelegate(CS$ < > 8__locals2, (UIntPtr)ldftn(< SyncFolders > b__0)), new FilterDelegate(null, (UIntPtr)ldftn(ExceptionFilter)), new CatchDelegate(CS$ < > 8__locals2, (UIntPtr)ldftn(< SyncFolders > b__1)));
                }
                if (CS$ < > 8__locals2.target.Children != null && CS$ < > 8__locals2.target.Children.Count > 0 && CS$ < > 8__locals2.source.Children != null && CS$ < > 8__locals2.source.Children.Count > 0)
                {
                    foreach (FolderTuple folderTuple in CS$ < > 8__locals2.target.Children.Values)
                    {
                        if (!string.IsNullOrEmpty(folderTuple.DisplayName))
                        {
                            FolderTuple folderTuple2 = null;
                            if (CS$ < > 8__locals2.source.Children.TryGetValue(folderTuple.DisplayName, out folderTuple2) && folderTuple2 != null)
                            {
                                queue.Enqueue(folderTuple2);
                                queue2.Enqueue(folderTuple);
                            }
                        }
                    }
                }
            }
        }
        // Token: 0x06000521 RID: 1313 RVA: 0x00026C5C File Offset: 0x00024E5C
        public void UpdatePropertiesOnFolderInArchive(FolderTuple source, FolderTuple targetInArchive)
        {
            FolderTupleCrossServerArchive folderTupleCrossServerArchive = targetInArchive as FolderTupleCrossServerArchive;

            this.AssignTagPropsToFolder(source, folderTupleCrossServerArchive, folderTupleCrossServerArchive.Folder, true);
        }
Пример #16
0
        // Token: 0x0600053C RID: 1340 RVA: 0x00027BA4 File Offset: 0x00025DA4
        public FolderTuple CreateAndUpdateFolderInArchive(FolderTuple parentInArchive, FolderTuple sourceInPrimary)
        {
            FolderTupleRemoteArchive folderTupleRemoteArchive = (FolderTupleRemoteArchive)parentInArchive;
            FolderType     folderType     = new FolderType();
            BaseFolderType baseFolderType = null;

            folderType.DisplayName = sourceInPrimary.DisplayName;
            List <ExtendedPropertyType> list = new List <ExtendedPropertyType>();

            for (FolderHelper.DataColumnIndex dataColumnIndex = FolderHelper.DataColumnIndex.startOfTagPropsIndex; dataColumnIndex <= FolderHelper.DataColumnIndex.containerClassIndex; dataColumnIndex++)
            {
                PropertyDefinition      key = FolderHelper.DataColumns[(int)dataColumnIndex];
                PathToExtendedFieldType pathToExtendedFieldType = this.EwsStorePropertyMapping[key];
                object obj = sourceInPrimary.FolderProps[key];
                if (obj != null && !(obj is PropertyError))
                {
                    obj = ElcEwsClientHelper.ConvertRetentionPropertyForService(obj, pathToExtendedFieldType.PropertyType);
                    ExtendedPropertyType item = new ExtendedPropertyType
                    {
                        ExtendedFieldURI = pathToExtendedFieldType,
                        Item             = obj
                    };
                    list.Add(item);
                }
            }
            if (list.Count > 0)
            {
                folderType.ExtendedProperty = list.ToArray();
            }
            try
            {
                baseFolderType = this.ArchiveEwsClient.CreateFolder(folderTupleRemoteArchive.EwsFolderId, folderType);
            }
            catch (ElcEwsException arg)
            {
                RemoteArchiveProcessorBase.Tracer.TraceError <string, MailboxSession, ElcEwsException>((long)this.GetHashCode(), "Create folder {0} in archive for {1} failed, Exception: {2}", sourceInPrimary.DisplayName, this.primaryMailboxSession, arg);
                throw;
            }
            if (baseFolderType != null)
            {
                try
                {
                    baseFolderType = this.ArchiveEwsClient.GetFolderById(baseFolderType.FolderId, this.FolderAllProperties.ToArray());
                    goto IL_16D;
                }
                catch (ElcEwsException arg2)
                {
                    RemoteArchiveProcessorBase.Tracer.TraceError <string, MailboxSession, ElcEwsException>((long)this.GetHashCode(), "Get newly created folder {0} in archive for {1} failed, Exception: {2}", sourceInPrimary.DisplayName, this.primaryMailboxSession, arg2);
                    throw;
                }
                goto IL_13E;
IL_16D:
                if (baseFolderType != null)
                {
                    return(new FolderTupleRemoteArchive(baseFolderType, baseFolderType.FolderId, folderTupleRemoteArchive.EwsFolderId, baseFolderType.DisplayName, RemoteArchiveProcessorBase.ConvertToFolderProperties(baseFolderType.ExtendedProperty)));
                }
                RemoteArchiveProcessorBase.Tracer.TraceError <string, MailboxSession>((long)this.GetHashCode(), "Get newly created folder {0} in archive for {1} returned no folder", sourceInPrimary.DisplayName, this.primaryMailboxSession);
                throw new ElcEwsException(ElcEwsErrorType.FailedToGetFolderById, "Get newly created folder {0} returned no folder");
            }
IL_13E:
            RemoteArchiveProcessorBase.Tracer.TraceError <string, MailboxSession>((long)this.GetHashCode(), "Create folder {0} in archive for {1} returned no folder", sourceInPrimary.DisplayName, this.primaryMailboxSession);
            throw new ElcEwsException(ElcEwsErrorType.FailedToCreateFolder, "Creating folder {0} returned no folder");
        }
Пример #17
0
        // Token: 0x0600053B RID: 1339 RVA: 0x000279E4 File Offset: 0x00025BE4
        public void UpdatePropertiesOnFolderInArchive(FolderTuple sourceInPrimary, FolderTuple targetInArchive)
        {
            FolderTupleRemoteArchive folderTupleRemoteArchive = targetInArchive as FolderTupleRemoteArchive;

            if (folderTupleRemoteArchive == null)
            {
                throw new ArgumentException("Archive folder tuple must be a FolderTupleRemoteArchive.", "targetInArchive");
            }
            List <FolderChangeDescriptionType> list = new List <FolderChangeDescriptionType>();

            for (FolderHelper.DataColumnIndex dataColumnIndex = FolderHelper.DataColumnIndex.startOfTagPropsIndex; dataColumnIndex <= FolderHelper.DataColumnIndex.containerClassIndex; dataColumnIndex++)
            {
                PropertyDefinition      key = FolderHelper.DataColumns[(int)dataColumnIndex];
                PathToExtendedFieldType pathToExtendedFieldType = this.EwsStorePropertyMapping[key];
                object obj  = sourceInPrimary.FolderProps[key];
                object obj2 = folderTupleRemoteArchive.FolderProps[key];
                if (obj != null && !(obj is PropertyError))
                {
                    string text = ElcEwsClientHelper.ConvertRetentionPropertyForService(obj, pathToExtendedFieldType.PropertyType);
                    string b    = ElcEwsClientHelper.ConvertRetentionPropertyForService(obj2, pathToExtendedFieldType.PropertyType);
                    if (text != b)
                    {
                        SetFolderFieldType   setFolderFieldType   = new SetFolderFieldType();
                        FolderType           folderType           = new FolderType();
                        ExtendedPropertyType extendedPropertyType = new ExtendedPropertyType
                        {
                            ExtendedFieldURI = pathToExtendedFieldType,
                            Item             = text
                        };
                        folderType.ExtendedProperty = new ExtendedPropertyType[]
                        {
                            extendedPropertyType
                        };
                        setFolderFieldType.Item  = pathToExtendedFieldType;
                        setFolderFieldType.Item1 = folderType;
                        list.Add(setFolderFieldType);
                    }
                }
                else if (obj2 != null)
                {
                    list.Add(new DeleteFolderFieldType
                    {
                        Item = pathToExtendedFieldType
                    });
                }
            }
            if (list.Count > 0)
            {
                RemoteArchiveProcessorBase.Tracer.TraceDebug <RemoteArchiveProcessorBase, int, string>((long)this.GetHashCode(), "{0}: {1} properties to be updated for folder {2}.", this, list.Count, folderTupleRemoteArchive.DisplayName);
                FolderChangeType folderChangeType = new FolderChangeType();
                folderChangeType.Item    = folderTupleRemoteArchive.EwsFolderId;
                folderChangeType.Updates = list.ToArray();
                try
                {
                    this.ArchiveEwsClient.UpdateFolder(folderChangeType);
                }
                catch (ElcEwsException arg)
                {
                    RemoteArchiveProcessorBase.Tracer.TraceError <MailboxSession, string, ElcEwsException>((long)this.GetHashCode(), "Update folder {1} in archive for {0} failed, Exception: {2}", this.primaryMailboxSession, folderTupleRemoteArchive.DisplayName, arg);
                    throw;
                }
            }
        }