Ejemplo n.º 1
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");
        }
Ejemplo n.º 2
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);
        }