// 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.");
     }
 }
Exemple #2
0
 // Token: 0x0600053F RID: 1343 RVA: 0x00027F10 File Offset: 0x00026110
 private void InitializeRetentionProperties()
 {
     this.folderExtendedRetentionProperties = new List <PathToExtendedFieldType>();
     this.ewsStorePropertyMapping           = new Dictionary <PropertyDefinition, PathToExtendedFieldType>();
     foreach (KeyValuePair <string, MapiPropertyTypeType> keyValuePair in RemoteArchiveProcessorBase.ExtendedRetentionPropertyTags)
     {
         string key = keyValuePair.Key;
         MapiPropertyTypeType    value = keyValuePair.Value;
         PathToExtendedFieldType pathToExtendedFieldType = new PathToExtendedFieldType();
         pathToExtendedFieldType.PropertyType = value;
         if (key == "-1")
         {
             pathToExtendedFieldType.PropertySetId = RemoteArchiveProcessorBase.RetentionTagEntryId.ToString();
             pathToExtendedFieldType.PropertyName  = "RetentionTagEntryId";
         }
         else
         {
             pathToExtendedFieldType.PropertyTag = key;
         }
         this.folderExtendedRetentionProperties.Add(pathToExtendedFieldType);
         FolderHelper.DataColumnIndex dataColumnIndex = RemoteArchiveProcessorBase.RetentionPropertyTagsMapping[key];
         PropertyDefinition           key2            = FolderHelper.DataColumns[(int)dataColumnIndex];
         this.ewsStorePropertyMapping.Add(key2, pathToExtendedFieldType);
     }
 }
Exemple #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()));
            }
        }
Exemple #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);
 }
Exemple #5
0
        // Token: 0x0600046B RID: 1131 RVA: 0x0001FE34 File Offset: 0x0001E034
        private void ResolveProperties(object[] folderProps)
        {
            this.folderProps = new Dictionary <PropertyDefinition, object>();
            if (folderProps != null && folderProps.Length > 0)
            {
                for (FolderHelper.DataColumnIndex dataColumnIndex = FolderHelper.DataColumnIndex.startOfTagPropsIndex; dataColumnIndex <= FolderHelper.DataColumnIndex.containerClassIndex; dataColumnIndex++)
                {
                    switch (dataColumnIndex)
                    {
                    case FolderHelper.DataColumnIndex.startOfTagPropsIndex:
                        this.FolderProps.Add(StoreObjectSchema.PolicyTag, folderProps[(int)dataColumnIndex]);
                        break;

                    case FolderHelper.DataColumnIndex.retentionPeriodIndex:
                        this.FolderProps.Add(StoreObjectSchema.RetentionPeriod, folderProps[(int)dataColumnIndex]);
                        break;

                    case FolderHelper.DataColumnIndex.retentionFlagsIndex:
                        this.FolderProps.Add(StoreObjectSchema.RetentionFlags, folderProps[(int)dataColumnIndex]);
                        break;

                    case FolderHelper.DataColumnIndex.archiveTagIndex:
                        this.FolderProps.Add(StoreObjectSchema.ArchiveTag, folderProps[(int)dataColumnIndex]);
                        break;

                    case FolderHelper.DataColumnIndex.archivePeriodIndex:
                        this.FolderProps.Add(StoreObjectSchema.ArchivePeriod, folderProps[(int)dataColumnIndex]);
                        break;

                    case FolderHelper.DataColumnIndex.retentionTagEntryId:
                        this.FolderProps.Add(FolderSchema.RetentionTagEntryId, folderProps[(int)dataColumnIndex]);
                        break;

                    case FolderHelper.DataColumnIndex.containerClassIndex:
                        this.FolderProps.Add(StoreObjectSchema.ContainerClass, folderProps[(int)dataColumnIndex]);
                        break;
                    }
                }
            }
        }
 // Token: 0x06000523 RID: 1315 RVA: 0x00026D00 File Offset: 0x00024F00
 private void InitializeRetentionProperties()
 {
     this.retentionExtendedProperties = new List <ExtendedPropertyDefinition>();
     this.ewsStorePropertyMapping     = new Dictionary <PropertyDefinition, ExtendedPropertyDefinition>();
     foreach (int num in this.retentionPropertyTags.Keys)
     {
         MapiPropertyType           mapiPropertyType = this.retentionPropertyTags[num];
         ExtendedPropertyDefinition extendedPropertyDefinition;
         if (num == -1)
         {
             Guid guid = new Guid("C7A4569B-F7AE-4DC2-9279-A8FE2F3CAF89");
             extendedPropertyDefinition = new ExtendedPropertyDefinition(guid, "RetentionTagEntryId", mapiPropertyType);
         }
         else
         {
             extendedPropertyDefinition = new ExtendedPropertyDefinition(num, mapiPropertyType);
         }
         this.retentionExtendedProperties.Add(extendedPropertyDefinition);
         FolderHelper.DataColumnIndex dataColumnIndex = this.retentionPropertyTagsMapping[num];
         PropertyDefinition           key             = FolderHelper.DataColumns[(int)dataColumnIndex];
         this.ewsStorePropertyMapping.Add(key, extendedPropertyDefinition);
     }
 }
Exemple #7
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");
        }
Exemple #8
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;
                }
            }
        }