예제 #1
0
        // Token: 0x0600053A RID: 1338 RVA: 0x000278A8 File Offset: 0x00025AA8
        public Dictionary <StoreObjectId, FolderTuple> GetFolderHierarchyInArchive()
        {
            Dictionary <StoreObjectId, FolderTuple> dictionary = new Dictionary <StoreObjectId, FolderTuple>();

            try
            {
                BaseFolderType folderById = this.ArchiveEwsClient.GetFolderById(new DistinguishedFolderIdType
                {
                    Id = DistinguishedFolderIdNameType.archivemsgfolderroot
                }, this.FolderAllProperties.ToArray());
                FolderTupleRemoteArchive folderTupleRemoteArchive = new FolderTupleRemoteArchive(folderById, folderById.FolderId, folderById.ParentFolderId, folderById.DisplayName, RemoteArchiveProcessorBase.ConvertToFolderProperties(folderById.ExtendedProperty), true);
                dictionary.Add(folderTupleRemoteArchive.FolderId, folderTupleRemoteArchive);
                IEnumerable <BaseFolderType> folderHierarchy = this.ArchiveEwsClient.GetFolderHierarchy(new DistinguishedFolderIdType
                {
                    Id = DistinguishedFolderIdNameType.archivemsgfolderroot
                }, true, this.folderAllProperties.ToArray());
                foreach (BaseFolderType baseFolderType in folderHierarchy)
                {
                    FolderTupleRemoteArchive folderTupleRemoteArchive2 = new FolderTupleRemoteArchive(baseFolderType, baseFolderType.FolderId, baseFolderType.ParentFolderId, baseFolderType.DisplayName, RemoteArchiveProcessorBase.ConvertToFolderProperties(baseFolderType.ExtendedProperty));
                    dictionary.Add(folderTupleRemoteArchive2.FolderId, folderTupleRemoteArchive2);
                }
            }
            catch (ElcEwsException arg)
            {
                RemoteArchiveProcessorBase.Tracer.TraceError <MailboxSession, ElcEwsException>((long)this.GetHashCode(), "Get folder hierarchy from archive for {0} failed, Exception: {1}", this.primaryMailboxSession, arg);
                throw;
            }
            return(dictionary);
        }
예제 #2
0
 // Token: 0x06000538 RID: 1336 RVA: 0x00027650 File Offset: 0x00025850
 public void MoveToArchive(TagExpirationExecutor.ItemSet itemSet, ElcSubAssistant assistant, FolderArchiver folderArchiver, int totalFailuresSoFar, ref List <Exception> allExceptionsSoFar, out List <string> foldersWithErrors, out int newMoveErrorsTotal)
 {
     if (this.PrimaryEwsClient == null)
     {
         throw new ElcEwsException(ElcEwsErrorType.PrimaryExchangeWebServiceNotAvailable, "Primary EWS url is unknown.");
     }
     foldersWithErrors  = new List <string>();
     newMoveErrorsTotal = 0;
     if (this.IsCrossPremise && this.moveToArchiveTotalCount > this.MoveToArchiveTotalCountLimit)
     {
         RemoteArchiveProcessorBase.Tracer.TraceDebug <RemoteArchiveProcessorBase>((long)this.GetHashCode(), "{0}: Move to archive total count limit reached.  No more item is moved to the archive mailbox during this run.", this);
         return;
     }
     using (Folder folder = Folder.Bind(this.primaryMailboxSession, itemSet.FolderId))
     {
         FolderTupleRemoteArchive folderTupleRemoteArchive = folderArchiver.GetArchiveFolderTuple(itemSet.FolderId) as FolderTupleRemoteArchive;
         if (folderTupleRemoteArchive != null)
         {
             RemoteArchiveProcessorBase.Tracer.TraceDebug <RemoteArchiveProcessorBase, 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, folderTupleRemoteArchive.DisplayName, folder.DisplayName);
             this.MoveItemsInBatches(itemSet.Items, folder, folderTupleRemoteArchive.Folder, ExpirationExecutor.Action.MoveToArchive, totalFailuresSoFar, ref allExceptionsSoFar, out foldersWithErrors, out newMoveErrorsTotal);
         }
         else
         {
             RemoteArchiveProcessorBase.Tracer.TraceWarning <RemoteArchiveProcessorBase, string>((long)this.GetHashCode(), "{0}: Unable to get target folder in the archive corresponding to source folder {1}. Will not move anything to it.", this, folder.DisplayName);
         }
     }
 }
예제 #3
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");
        }
예제 #4
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;
                }
            }
        }