Exemple #1
0
 private string GetSyncState(StoreSession storeSession, byte[] key, CoreFolder folder)
 {
     using (QueryResult queryResult = folder.QueryExecutor.ItemQuery(ItemQueryType.None, new ComparisonFilter(ComparisonOperator.Equal, ItemSchema.ReplyTemplateId, this.GetSyncStateSearchKey(key)), null, new PropertyDefinition[]
     {
         ItemSchema.Id
     }))
     {
         object[][] rows = queryResult.GetRows(1);
         if (rows.Length == 1)
         {
             VersionedId versionedId = rows[0][0] as VersionedId;
             if (versionedId == null)
             {
                 return(null);
             }
             try
             {
                 using (Item item = Item.Bind(storeSession, versionedId))
                 {
                     using (Stream stream = item.PropertyBag.OpenPropertyStream(MailboxProviderBase.SyncStateStorePropertyDefinition, PropertyOpenMode.ReadOnly))
                     {
                         using (StreamReader streamReader = new StreamReader(stream))
                         {
                             return(streamReader.ReadToEnd());
                         }
                     }
                 }
             }
             catch (ObjectNotFoundException)
             {
             }
         }
     }
     return(null);
 }
 internal static void WriteFolderAclTable(CoreFolder coreFolder, byte[] propertyToSet)
 {
     using (FolderPropertyStream folderPropertyStream = (FolderPropertyStream)coreFolder.PropertyBag.OpenPropertyStream(CoreFolderSchema.AclTableAndSecurityDescriptor, PropertyOpenMode.Modify))
     {
         folderPropertyStream.Write(propertyToSet, 0, propertyToSet.Length);
     }
 }
        private void OnBeforeCreateFolder(Folder parentFolder)
        {
            PublicFolderSession publicFolderSession = base.Session as PublicFolderSession;

            if (publicFolderSession == null)
            {
                return;
            }
            if (this.isSearchFolder)
            {
                base.SetProperty(CoreFolderSchema.ReplicaList, new string[]
                {
                    publicFolderSession.MailboxGuid.ToString()
                });
                return;
            }
            PublicFolderContentMailboxInfo contentMailboxInfo  = CoreFolder.GetContentMailboxInfo(base.GetValueOrDefault <string[]>(CoreFolderSchema.ReplicaList, Array <string> .Empty));
            PublicFolderContentMailboxInfo contentMailboxInfo2 = parentFolder.GetContentMailboxInfo();
            Guid guid = contentMailboxInfo.IsValid ? contentMailboxInfo.MailboxGuid : (contentMailboxInfo2.IsValid ? contentMailboxInfo2.MailboxGuid : publicFolderSession.MailboxGuid);

            base.SetProperty(CoreFolderSchema.ReplicaList, new string[]
            {
                guid.ToString()
            });
        }
Exemple #4
0
 private void LoadFolderHierarchy(StoreObjectId rootFolderId, NativeStorePropertyDefinition[] propertiesToLoad, List <FolderRec> result)
 {
     using (CoreFolder coreFolder = CoreFolder.Bind(this.StoreSession, rootFolderId))
     {
         FolderRec folderRec = this.GetFolderRec(coreFolder, propertiesToLoad);
         if (base.Flags.HasFlag(LocalMailboxFlags.ParallelPublicFolderMigration))
         {
             folderRec.FolderName = "Public Root";
         }
         result.Add(folderRec);
         using (QueryResult queryResult = coreFolder.QueryExecutor.FolderQuery(FolderQueryFlags.DeepTraversal, null, null, propertiesToLoad))
         {
             object[][] rows;
             do
             {
                 using (base.RHTracker.Start())
                 {
                     rows = queryResult.GetRows(1000);
                 }
                 foreach (object[] values in rows)
                 {
                     FolderRec folderRec2 = FolderRec.Create(this.StoreSession, propertiesToLoad, values);
                     if (folderRec2 != null)
                     {
                         result.Add(folderRec2);
                     }
                 }
             }while (rows.Length != 0);
         }
     }
 }
Exemple #5
0
        public static FolderRec Create(StoreSession storageSession, PropValue[] pva)
        {
            byte[]               array      = null;
            byte[]               array2     = null;
            FolderType           folderType = FolderType.Generic;
            string               text       = null;
            DateTime             dateTime   = DateTime.MinValue;
            List <PropValueData> list       = new List <PropValueData>();

            foreach (PropValue native in pva)
            {
                if (!native.IsNull() && !native.IsError())
                {
                    PropTag propTag = native.PropTag;
                    if (propTag <= PropTag.EntryId)
                    {
                        if (propTag == PropTag.ParentEntryId)
                        {
                            array2 = native.GetBytes();
                            goto IL_CD;
                        }
                        if (propTag == PropTag.EntryId)
                        {
                            array = native.GetBytes();
                            goto IL_CD;
                        }
                    }
                    else
                    {
                        if (propTag == PropTag.DisplayName)
                        {
                            text = native.GetString();
                            goto IL_CD;
                        }
                        if (propTag == PropTag.LastModificationTime)
                        {
                            dateTime = native.GetDateTime();
                            goto IL_CD;
                        }
                        if (propTag == PropTag.FolderType)
                        {
                            folderType = (FolderType)native.GetInt();
                            goto IL_CD;
                        }
                    }
                    list.Add(DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(native));
                }
                IL_CD :;
            }
            if (array != null)
            {
                FolderRec folderRec = new FolderRec(array, array2, folderType, text, dateTime, (list.Count > 0) ? list.ToArray() : null);
                if (storageSession != null && folderRec[PropTag.ReplicaList] != null)
                {
                    folderRec.IsGhosted = !CoreFolder.IsContentAvailable(storageSession, CoreFolder.GetContentMailboxInfo(ReplicaListProperty.GetStringArrayFromBytes((byte[])folderRec[PropTag.ReplicaList])));
                }
                return(folderRec);
            }
            return(null);
        }
Exemple #6
0
        public T GetFolder <T>(byte[] folderId) where T : StorageFolder, new()
        {
            base.VerifyMailboxConnection(VerifyMailboxConnectionFlags.None);
            T result;

            using (base.RHTracker.Start())
            {
                StoreObjectId folderId2 = this.GetFolderId(folderId);
                CoreFolder    coreFolder;
                try
                {
                    coreFolder = CoreFolder.Bind(this.StoreSession, folderId2);
                }
                catch (ObjectNotFoundException)
                {
                    return(default(T));
                }
                if (MrsTracer.Provider.IsEnabled(TraceType.DebugTrace))
                {
                    coreFolder.PropertyBag.Load(new PropertyDefinition[]
                    {
                        FolderSchema.DisplayName
                    });
                    object obj = coreFolder.PropertyBag.TryGetProperty(FolderSchema.DisplayName);
                    MrsTracer.Provider.Debug("Opened folder '{0}'", new object[]
                    {
                        obj
                    });
                }
                StorageFolder storageFolder = Activator.CreateInstance <T>();
                storageFolder.Config(folderId, coreFolder, this);
                result = (T)((object)storageFolder);
            }
            return(result);
        }
Exemple #7
0
 internal ContactsFolder(CoreFolder coreFolder) : base(coreFolder)
 {
     if (base.IsNew)
     {
         this.Initialize();
     }
 }
Exemple #8
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;
             }
         }
     }
 }
        public static void ApplyPolicyToFolder(MailboxSession session, CoreFolder coreFolder)
        {
            if (coreFolder.Origin == Origin.Existing)
            {
                PropertyDefinition[] folderProperties = PolicyTagHelper.FolderProperties;
                for (int i = 0; i < folderProperties.Length; i++)
                {
                    if (coreFolder.PropertyBag.IsPropertyDirty(folderProperties[i]))
                    {
                        int    num = 0;
                        object obj = coreFolder.PropertyBag.TryGetProperty(InternalSchema.RetentionFlags);
                        if (obj is int)
                        {
                            num = (int)obj;
                        }
                        num = FlagsMan.SetNeedRescan(num);
                        coreFolder.PropertyBag.SetProperty(InternalSchema.RetentionFlags, num);
                        return;
                    }
                }
                return;
            }
            int    num2 = 0;
            object obj2 = coreFolder.PropertyBag.TryGetProperty(InternalSchema.RetentionFlags);

            if (obj2 is int)
            {
                num2 = (int)obj2;
            }
            num2 = FlagsMan.SetNeedRescan(num2);
            coreFolder.PropertyBag.SetProperty(InternalSchema.RetentionFlags, num2);
        }
        protected SynchronizationUploadContextBase(CoreFolder folder, StorageIcsState initialState)
        {
            Util.ThrowOnNullArgument(folder, "folder");
            this.folder = folder;
            StoreSession session = this.Session;
            bool         flag    = false;

            try
            {
                if (session != null)
                {
                    session.BeginMapiCall();
                    session.BeginServerHealthCall();
                    flag = true;
                }
                if (StorageGlobals.MapiTestHookBeforeCall != null)
                {
                    StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                }
                this.mapiCollector = this.MapiCreateCollector(initialState);
            }
            catch (MapiPermanentException ex)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.CannotCreateCollector(base.GetType()), ex, session, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("SynchronizationUploadContext::MapiCreateCollector failed", new object[0]),
                    ex
                });
            }
            catch (MapiRetryableException ex2)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.CannotCreateCollector(base.GetType()), ex2, session, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("SynchronizationUploadContext::MapiCreateCollector failed", new object[0]),
                    ex2
                });
            }
            finally
            {
                try
                {
                    if (session != null)
                    {
                        session.EndMapiCall();
                        if (flag)
                        {
                            session.EndServerHealthCall();
                        }
                    }
                }
                finally
                {
                    if (StorageGlobals.MapiTestHookAfterCall != null)
                    {
                        StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                    }
                }
            }
            this.mapiCollector.AllowWarnings = true;
        }
            internal FolderInformation(CoreFolder coreFolder)
            {
                this.propertyBag = CoreObject.GetPersistablePropertyBag(coreFolder);
                this.propertyBag.Load(MapiAclTableRestriction.FolderInformation.PropertyDefinitions);
                string valueOrDefault = this.propertyBag.GetValueOrDefault <string>(StoreObjectSchema.ContainerClass);

                this.storeObjectType = ObjectClass.GetObjectType(valueOrDefault);
            }
Exemple #12
0
 public static bool IsDumpsterFolder(CoreFolder folder)
 {
     if (!(folder.Session is PublicFolderSession))
     {
         throw new InvalidOperationException("folder must be associated with PublicFolderSession");
     }
     folder.PropertyBag.Load(PublicFolderCOWSession.propertiesToLoadForDumpster);
     return((folder.PropertyBag.GetValueOrDefault <ELCFolderFlags>(FolderSchema.AdminFolderFlags, ELCFolderFlags.None) & ELCFolderFlags.DumpsterFolder) != ELCFolderFlags.None);
 }
Exemple #13
0
        private FolderRec GetFolderRec(StoreObjectId folderId, NativeStorePropertyDefinition[] propertiesToLoad)
        {
            FolderRec folderRec;

            using (CoreFolder coreFolder = CoreFolder.Bind(this.StoreSession, folderId))
            {
                folderRec = this.GetFolderRec(coreFolder, propertiesToLoad);
            }
            return(folderRec);
        }
Exemple #14
0
 private FolderRec GetFolderRec(CoreFolder folder, NativeStorePropertyDefinition[] propertiesToLoad)
 {
     folder.PropertyBag.Load(propertiesToLoad);
     object[] array = new object[propertiesToLoad.Length];
     for (int i = 0; i < propertiesToLoad.Length; i++)
     {
         array[i] = folder.PropertyBag.TryGetProperty(propertiesToLoad[i]);
     }
     return(FolderRec.Create(this.StoreSession, propertiesToLoad, array));
 }
Exemple #15
0
 public static StoreObjectId GetRecoverableItemsDeletionsFolderId(CoreFolder folder)
 {
     byte[] valueOrDefault = folder.PropertyBag.GetValueOrDefault <byte[]>(CoreFolderSchema.DeletedItemsEntryId, Array <byte> .Empty);
     if (valueOrDefault.Length == 22)
     {
         return(folder.Session.IdConverter.CreateFolderId(folder.Session.IdConverter.GetIdFromLongTermId(valueOrDefault)));
     }
     if (valueOrDefault.Length == 46)
     {
         return(StoreObjectId.FromProviderSpecificId(valueOrDefault, StoreObjectType.Folder));
     }
     return(null);
 }
        protected UserConfiguration GetMailboxConfiguration(CoreFolder folder)
        {
            UserConfigurationManager userConfigurationManager = ((MailboxSession)folder.Session).UserConfigurationManager;
            UserConfiguration        result;

            try
            {
                result = userConfigurationManager.GetFolderConfiguration("OlcCalendarFolderSettings", UserConfigurationTypes.Dictionary, folder.Id);
            }
            catch (ObjectNotFoundException)
            {
                result = userConfigurationManager.CreateFolderConfiguration("OlcCalendarFolderSettings", UserConfigurationTypes.Dictionary, folder.Id);
            }
            return(result);
        }
 internal PropertyTable(CoreFolder coreFolder, NativeStorePropertyDefinition property, ModifyTableOptions options, IModifyTableRestriction modifyTableRestriction)
 {
     Util.ThrowOnNullArgument(coreFolder, "coreFolder");
     Util.ThrowOnNullArgument(property, "property");
     EnumValidator.ThrowIfInvalid <ModifyTableOptions>(options);
     using (DisposeGuard disposeGuard = this.Guard())
     {
         this.mapiModifyTable        = PropertyTable.GetMapiModifyTable(coreFolder, property);
         this.session                = coreFolder.Session;
         this.propertyReference      = this.session.Mailbox.MapiStore;
         this.tableNameForTracing    = property.Name;
         this.options                = options;
         this.modifyTableRestriction = modifyTableRestriction;
         disposeGuard.Success();
     }
 }
Exemple #18
0
 internal void Save(CoreFolder coreFolder)
 {
     this.CheckValid();
     Util.ThrowOnNullArgument(coreFolder, "coreFolder");
     if (this.IsDirty)
     {
         this.EnforceRestriction(coreFolder);
         this.SaveSharingPartnership(coreFolder.Session as MailboxSession);
         using (IModifyTable permissionTable = coreFolder.GetPermissionTable(this.PermissionSet.ModifyTableOptions))
         {
             MapiAclTableAdapter mapiAclTableAdapter = new MapiAclTableAdapter(permissionTable);
             this.AddPermissionEntriesForRemove(mapiAclTableAdapter);
             this.AddPermissionEntriesForAddOrModify(mapiAclTableAdapter);
             mapiAclTableAdapter.ApplyPendingChanges(true);
         }
     }
     this.isInvalid = true;
 }
Exemple #19
0
 private void ExecuteSyncStateOperation(Action <StoreSession, CoreFolder> operation)
 {
     using (base.RHTracker.Start())
     {
         if (base.IsPublicFolderMove || base.IsPublicFolderMailboxRestore)
         {
             PublicFolderSession publicFolderSession = this.GetPublicFolderSession();
             using (CoreFolder coreFolder = CoreFolder.Bind(publicFolderSession, publicFolderSession.GetTombstonesRootFolderId()))
             {
                 operation(publicFolderSession, coreFolder);
                 goto IL_A9;
             }
         }
         MailboxSession mailboxSession = null;
         bool           flag           = false;
         try
         {
             if (base.UseHomeMDB)
             {
                 mailboxSession = this.GetMailboxSession();
             }
             else
             {
                 mailboxSession = this.OpenSystemMailbox();
                 flag           = true;
             }
             using (CoreFolder coreFolder2 = CoreFolder.Create(mailboxSession, mailboxSession.GetDefaultFolderId(DefaultFolderType.Configuration), false, "MailboxReplicationService SyncStates", CreateMode.OpenIfExists))
             {
                 coreFolder2.Save(SaveMode.FailOnAnyConflict);
                 operation(mailboxSession, coreFolder2);
             }
         }
         finally
         {
             if (flag && mailboxSession != null)
             {
                 mailboxSession.Dispose();
             }
         }
         IL_A9 :;
     }
 }
        public override void Apply(CoreFolder folder)
        {
            using (UserConfiguration mailboxConfiguration = this.GetMailboxConfiguration(folder))
            {
                IDictionary dictionary = mailboxConfiguration.GetDictionary();
                dictionary["OlcIsVisible"]                     = this.IsVisible;
                dictionary["OlcIsHidden"]                      = this.IsHidden;
                dictionary["OlcColorIndex"]                    = this.ColorIndex;
                dictionary["OlcIsDailySummaryEnabled"]         = this.IsDailySummaryEnabled;
                dictionary["ConsumerTaskPermissionLevel"]      = this.ConsumerTaskPermissionLevel;
                dictionary["OlcConsecutiveErrorCount"]         = this.ConsecutiveErrorCount;
                dictionary["OlcTotalErrorCount"]               = this.TotalErrorCount;
                dictionary["OlcPollingInterval"]               = this.PollingInterval;
                dictionary["OlcEntityTag"]                     = (this.EntityTag ?? string.Empty);
                dictionary["OlcImportedEventCount"]            = this.ImportedEventCount;
                dictionary["OlcTotalEventCount"]               = this.TotalEventCount;
                dictionary["OlcUpdateStatus"]                  = this.UpdateStatus;
                dictionary["OlcMissingUidCount"]               = this.MissingUidCount;
                dictionary["OlcConsecutiveCriticalErrorCount"] = this.ConsecutiveCriticalErrorCount;
                dictionary["OlcPersonIdMigrated"]              = this.PersonIdMigrated;
                ConflictResolutionResult conflictResolutionResult = mailboxConfiguration.Save(SaveMode.ResolveConflicts);
                if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
                {
                    throw new ConversionFailedException(ConversionFailureReason.ConverterInternalFailure, MrsStrings.ReportCalendarFolderFaiSaveFailed, null);
                }
                MrsTracer.Provider.Debug("Calendar folder user configuration has been updated.", new object[0]);
            }
            folder.PropertyBag.Load(CalendarFolderSchema.Instance.AutoloadProperties);
            if (this.OlcCalendarType != OlcCalendarType.RegularEvents)
            {
                folder.PropertyBag[FolderSchema.DisplayName] = (this.Name ?? string.Empty);
            }
            folder.PropertyBag[CalendarFolderSchema.CharmId] = (this.CharmId ?? string.Empty);
            FolderSaveResult folderSaveResult = folder.Save(SaveMode.NoConflictResolution);

            if (folderSaveResult.OperationResult == OperationResult.Failed)
            {
                throw new ConversionFailedException(ConversionFailureReason.ConverterInternalFailure, MrsStrings.ReportCalendarFolderSaveFailed, null);
            }
            MrsTracer.Provider.Debug("Calendar folder has been updated with settings.", new object[0]);
            folder.PropertyBag.Load(CalendarFolderSchema.Instance.AutoloadProperties);
        }
 internal AclModifyTable(CoreFolder coreFolder, ModifyTableOptions options, IModifyTableRestriction modifyTableRestriction, bool useSecurityDescriptorOnly, bool loadTableEntries)
 {
     using (DisposeGuard disposeGuard = this.Guard())
     {
         this.coreFolder                = coreFolder;
         this.options                   = options;
         this.modifyTableRestriction    = modifyTableRestriction;
         this.recipientSession          = coreFolder.Session.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid);
         this.useSecurityDescriptorOnly = useSecurityDescriptorOnly;
         if (loadTableEntries)
         {
             this.Load();
         }
         else
         {
             this.replaceAllRows = true;
         }
         disposeGuard.Success();
     }
 }
Exemple #22
0
 internal static void SyncPublicFolder(IConfigurationSession configurationSession, StoreObjectId folderId)
 {
     using (PublicFolderDataProvider publicFolderDataProvider = new PublicFolderDataProvider(configurationSession, "*-PublicFolderClientPermission", Guid.Empty))
     {
         PublicFolderSession publicFolderSession = publicFolderDataProvider.PublicFolderSession;
         using (CoreFolder coreFolder = CoreFolder.Bind(publicFolderSession, folderId, new PropertyDefinition[]
         {
             CoreFolderSchema.AclTableAndSecurityDescriptor
         }))
         {
             PublicFolderContentMailboxInfo contentMailboxInfo = coreFolder.GetContentMailboxInfo();
             Guid guid = contentMailboxInfo.IsValid ? contentMailboxInfo.MailboxGuid : Guid.Empty;
             ExchangePrincipal contentMailboxPrincipal;
             if (guid != Guid.Empty && guid != publicFolderSession.MailboxGuid && PublicFolderSession.TryGetPublicFolderMailboxPrincipal(publicFolderSession.OrganizationId, guid, true, out contentMailboxPrincipal))
             {
                 PublicFolderSyncJobRpc.SyncFolder(contentMailboxPrincipal, folderId.ProviderLevelItemId);
             }
         }
     }
 }
 protected override void InternalProcessRecord()
 {
     try
     {
         if (this.Path != null)
         {
             PublicFolder publicFolder = (PublicFolder)base.GetDataObject <PublicFolder>(this.Path, base.DataSession, null, new LocalizedString?(Strings.ErrorPublicFolderNotFound(this.Path.ToString())), new LocalizedString?(Strings.ErrorPublicFolderNotUnique(this.Path.ToString())));
             using (this.publicFolderDataProvider.PublicFolderSession.GetRestrictedOperationToken())
             {
                 using (CoreFolder coreFolder = CoreFolder.Bind(this.publicFolderDataProvider.PublicFolderSession, publicFolder.InternalFolderIdentity.ObjectId))
                 {
                     coreFolder.MoveFolder(coreFolder, this.DataObject.InternalFolderIdentity.ObjectId);
                     this.folderUpdated = true;
                 }
             }
         }
         if (this.OverrideContentMailbox != null && (this.Force || base.ShouldContinue(Strings.ConfirmationMessageOverrideContentMailbox)))
         {
             PublicFolder publicFolder2 = (PublicFolder)base.GetDataObject <PublicFolder>(this.Identity, base.DataSession, null, new LocalizedString?(Strings.ErrorPublicFolderNotFound(this.Identity.ToString())), new LocalizedString?(Strings.ErrorPublicFolderNotUnique(this.Identity.ToString())));
             using (this.publicFolderDataProvider.PublicFolderSession.GetRestrictedOperationToken())
             {
                 using (CoreFolder coreFolder2 = CoreFolder.Bind(this.publicFolderDataProvider.PublicFolderSession, publicFolder2.InternalFolderIdentity.ObjectId))
                 {
                     coreFolder2.PropertyBag.SetProperty(CoreFolderSchema.ReplicaList, new string[]
                     {
                         this.contentMailboxGuid.ToString()
                     });
                     coreFolder2.PropertyBag.SetProperty(CoreFolderSchema.LastMovedTimeStamp, ExDateTime.UtcNow);
                     coreFolder2.Save(SaveMode.NoConflictResolution);
                     this.folderUpdated = true;
                 }
             }
         }
         base.InternalProcessRecord();
     }
     catch (NotSupportedException exception)
     {
         base.WriteError(exception, ErrorCategory.InvalidType, this.Identity);
     }
 }
Exemple #24
0
        public void ItemOperation(COWSettings settings, IDumpsterItemOperations dumpster, COWTriggerAction operation, COWTriggerActionState state, StoreSession session, StoreObjectId itemId, CoreItem item, CoreFolder folder, bool onBeforeNotification, OperationResult result, CallbackContext callbackContext)
        {
            Util.ThrowOnNullArgument(session, "session");
            EnumValidator.ThrowIfInvalid <COWTriggerAction>(operation, "operation");
            EnumValidator.ThrowIfInvalid <COWTriggerActionState>(state, "state");
            EnumValidator.ThrowIfInvalid <OperationResult>(result, "result");
            Util.ThrowOnNullArgument(item, "item");
            MailboxSession mailboxSession = session as MailboxSession;
            ExDateTime     now            = ExDateTime.Now;

            try
            {
                item.PropertyBag.Load(COWSiteMailboxMessageDedup.PropsForMessageRemoval);
                if (item.Id != null && item.Id.ObjectId != null)
                {
                    StoreObjectId storeObjectId = item.PropertyBag.TryGetProperty(StoreObjectSchema.ParentItemId) as StoreObjectId;
                    if (storeObjectId != null)
                    {
                        using (CoreFolder coreFolder = CoreFolder.Bind(session, storeObjectId))
                        {
                            DeleteItemFlags deleteItemFlags = DeleteItemFlags.HardDelete | DeleteItemFlags.SuppressReadReceipt;
                            coreFolder.DeleteItems(deleteItemFlags, new StoreObjectId[]
                            {
                                item.Id.ObjectId
                            });
                        }
                        COWSiteMailboxMessageDedup.Tracer.TraceDebug <StoreObjectId, string, double>((long)this.GetHashCode(), "COWSiteMailboxMessageDedup.ItemOperation: deleting message {0} from site mailbox {1} used {2} milliseconds", itemId, mailboxSession.DisplayName, (ExDateTime.Now - now).TotalMilliseconds);
                    }
                }
            }
            catch (StoragePermanentException arg)
            {
                COWSiteMailboxMessageDedup.Tracer.TraceError <StoragePermanentException>((long)this.GetHashCode(), "COWSiteMailboxMessageDedup.ItemOperation: got store permanent exception: {0}", arg);
            }
            catch (StorageTransientException arg2)
            {
                COWSiteMailboxMessageDedup.Tracer.TraceError <StorageTransientException>((long)this.GetHashCode(), "COWSiteMailboxMessageDedup.ItemOperation: got store transient exception: {0}", arg2);
            }
            callbackContext.SiteMailboxMessageDedupState = COWProcessorState.Processed;
        }
Exemple #25
0
        public FolderBindHistoryManager(CoreFolder folder)
        {
            Util.ThrowOnNullArgument(folder, "folder");
            this.currentFolder   = folder;
            this.ShouldSkipAudit = false;
            this.bindingHistory.Add(this.GenerateBindingEntry());
            string[] array = this.ReadRecentHistory();
            if (array == null)
            {
                return;
            }
            string bindingEntryIdentity = this.GetBindingEntryIdentity();
            long   num = (long)(DateTime.UtcNow - FolderBindHistoryManager.Epoch).TotalMinutes;

            foreach (string text in array)
            {
                if (text != null)
                {
                    string[] array3 = text.Split(new char[0]);
                    long     num2;
                    if (array3.Length == 2 && long.TryParse(array3[0], out num2))
                    {
                        if (bindingEntryIdentity.Equals(array3[1], StringComparison.OrdinalIgnoreCase))
                        {
                            if ((double)(num - num2) < FolderBindHistoryManager.HistoryRefreshTime.TotalMinutes)
                            {
                                this.ShouldSkipAudit = true;
                            }
                        }
                        else if ((double)(num - num2) < FolderBindHistoryManager.HistoryRefreshTime.TotalMinutes)
                        {
                            this.bindingHistory.Add(text);
                        }
                    }
                }
            }
        }
Exemple #26
0
 private void LoadFrom(CoreFolder coreFolder)
 {
     using (IModifyTable permissionTable = coreFolder.GetPermissionTable(this.PermissionSet.ModifyTableOptions))
     {
         try
         {
             this.LoadFrom(new MapiAclTableAdapter(permissionTable));
         }
         catch (DataSourceOperationException ex)
         {
             throw StorageGlobals.TranslateDirectoryException(ServerStrings.ADException, ex, null, "PermissionsTable.LoadFrom. Failed due to directory exception {0}.", new object[]
             {
                 ex
             });
         }
         catch (DataSourceTransientException ex2)
         {
             throw StorageGlobals.TranslateDirectoryException(ServerStrings.ADException, ex2, null, "PermissionsTable.LoadFrom. Failed due to directory exception {0}.", new object[]
             {
                 ex2
             });
         }
     }
 }
Exemple #27
0
 void IDestinationMailbox.MoveFolder(byte[] folderId, byte[] oldParentId, byte[] newParentId)
 {
     MrsTracer.Provider.Function("StorageDestinationMailbox.MoveFolder", new object[0]);
     base.VerifyMailboxConnection(VerifyMailboxConnectionFlags.None);
     using (base.RHTracker.Start())
     {
         using (CoreFolder coreFolder = CoreFolder.Bind(base.StoreSession, base.GetFolderId(oldParentId)))
         {
             using (CoreFolder coreFolder2 = CoreFolder.Bind(base.StoreSession, base.GetFolderId(newParentId)))
             {
                 GroupOperationResult groupOperationResult = coreFolder.MoveFolder(coreFolder2, StoreObjectId.FromProviderSpecificId(folderId));
                 if (groupOperationResult.OperationResult != OperationResult.Succeeded)
                 {
                     MrsTracer.Provider.Error("StorageDestinationMailbox.MoveFolder failed with {0}", new object[]
                     {
                         groupOperationResult.Exception.ToString()
                     });
                     groupOperationResult.Exception.PreserveExceptionStack();
                     throw groupOperationResult.Exception;
                 }
             }
         }
     }
 }
 public ContentsSynchronizationUploadContext(CoreFolder folder, StorageIcsState initialState) : base(folder, initialState)
 {
 }
 internal override void Config(byte[] folderId, CoreFolder folder, StorageMailbox mailbox)
 {
     base.Config(folderId, folder, mailbox);
     this.MapiFolder.AllowWarnings = true;
 }
Exemple #30
0
 internal SearchFolder(CoreFolder coreFolder) : base(coreFolder)
 {
 }