Exemplo n.º 1
0
 private SearchFolderCriteria CreateSearchCriteria(DefaultFolderContext context)
 {
     return(new SearchFolderCriteria(FavoritesFolderValidation.GetQueryFilter(), new StoreId[]
     {
         context[DefaultFolderType.QuickContacts]
     }));
 }
Exemplo n.º 2
0
        protected override void SetPropertiesInternal(DefaultFolderContext context, Folder folder)
        {
            base.SetPropertiesInternal(context, folder);
            SearchFolderCriteria searchFolderCriteria = null;
            SearchFolder         searchFolder         = (SearchFolder)folder;

            searchFolder[InternalSchema.ContainerClass] = "IPF.Task";
            int num = 786432;

            searchFolder[InternalSchema.ExtendedFolderToDoVersion] = num;
            searchFolder.Save();
            searchFolder.Load(null);
            try
            {
                searchFolderCriteria = searchFolder.GetSearchCriteria();
            }
            catch (ObjectNotInitializedException arg)
            {
                ExTraceGlobals.DefaultFoldersTracer.TraceDebug <string, ObjectNotInitializedException>((long)this.GetHashCode(), "ToDoSearchValidation::SetPropertiesInternal. Failed to get search criteria on the folder with name {0} due to {1}. It can be normal though for a search folder without search criteria applied yet.", searchFolder.DisplayName, arg);
            }
            if (searchFolderCriteria == null || !ToDoSearchValidation.MatchedToDoSearchCriteriaApproxly(searchFolderCriteria))
            {
                ExTraceGlobals.DefaultFoldersTracer.TraceDebug <string, SearchFolderCriteria, SearchFolderCriteria>((long)this.GetHashCode(), "ToDoSearchValidation::SetPropertiesInternal. Apply ToDo search criteria on the folder. DisplayName = {0}, currentCriteria = {1}, newCriteria = {2}.", searchFolder.DisplayName, searchFolderCriteria, ToDoSearchValidation.GetToDoSearchCriteria(context));
                searchFolder.ApplyContinuousSearch(ToDoSearchValidation.GetToDoSearchCriteria(context));
            }
        }
Exemplo n.º 3
0
        private static SearchFolderCriteria CreateRemindersQueryForO12(DefaultFolderContext context, IEnumerable <QueryFilter> currentExclusionCriteria)
        {
            QueryFilter searchQuery = new AndFilter(new QueryFilter[]
            {
                SearchFolderValidation.GetSearchExclusionFoldersFilter(context, currentExclusionCriteria, SearchFolderValidation.ExcludeFromRemindersSearchFolder),
                new AndFilter(new QueryFilter[]
                {
                    new NotFilter(new AndFilter(new QueryFilter[]
                    {
                        new ExistsFilter(InternalSchema.ItemClass),
                        new TextFilter(InternalSchema.ItemClass, "IPM.Schedule", MatchOptions.Prefix, MatchFlags.Default)
                    })),
                    new ComparisonFilter(ComparisonOperator.Equal, InternalSchema.HasBeenSubmitted, false),
                    RemindersSearchFolderValidation.CreateRemindersQueryForO11(context).SearchQuery
                })
            });

            return(new SearchFolderCriteria(searchQuery, new StoreId[]
            {
                context.Session.GetDefaultFolderId(DefaultFolderType.Root)
            })
            {
                DeepTraversal = true
            });
        }
 public void SetProperties(DefaultFolderContext context, Folder folder)
 {
     MatchAdminFolderFlags.< > c__DisplayClass2 CS$ < > 8__locals1 = new MatchAdminFolderFlags.< > c__DisplayClass2();
     CS$ < > 8__locals1.folder      = folder;
     CS$ < > 8__locals1.< > 4__this = this;
     ExTraceGlobals.DefaultFoldersTracer.TraceDebug <ELCFolderFlags, Folder>((long)this.GetHashCode(), "MatchAdminFolderFlags::SetPropertiesInternal. Setting AdminFolderFlags to {0} for folder {1} on the admin session.", this.adminFolderFlags, CS$ < > 8__locals1.folder);
     if (context.Session.LogonType == LogonType.Admin || (context.Session != null && context.Session.IsMoveUser))
     {
         CS$ < > 8__locals1.folder[InternalSchema.AdminFolderFlags] = this.adminFolderFlags;
         return;
     }
     using (MailboxSession adminSession = MailboxSession.OpenAsAdmin(context.Session.MailboxOwner, CultureInfo.InvariantCulture, context.Session.ClientInfoString + ";COW=DumpsterFolderFlag"))
     {
         adminSession.BypassAuditing(delegate
         {
             adminSession.BypassAuditsFolderAccessChecking(delegate
             {
                 using (Folder folder2 = Folder.Bind(adminSession, CS$ < > 8__locals1.folder.Id, new PropertyDefinition[]
                 {
                     FolderSchema.AdminFolderFlags
                 }))
                 {
                     folder2[InternalSchema.AdminFolderFlags] = CS$ < > 8__locals1.< > 4__this.adminFolderFlags;
                     folder2.Save();
                 }
             });
Exemplo n.º 5
0
 public void SetProperties(DefaultFolderContext context, Folder folder)
 {
     foreach (IValidator validator in this.validators)
     {
         validator.SetProperties(context, folder);
     }
 }
Exemplo n.º 6
0
 protected virtual void SetPropertiesInternal(DefaultFolderContext context, Folder folder)
 {
     foreach (IValidator validator in this.validators)
     {
         validator.SetProperties(context, folder);
     }
 }
Exemplo n.º 7
0
 private static SearchFolderCriteria GetSearchCriteria(DefaultFolderContext context)
 {
     return(new SearchFolderCriteria(FromFavoriteSendersFolderValidation.SearchQueryFilter, new StoreId[]
     {
         context.Session.GetDefaultFolderId(DefaultFolderType.Inbox)
     }));
 }
        internal override void SetEntryId(DefaultFolderContext context, byte[] entryId)
        {
            Ex12ExRenEntryParser ex12ExRenEntryParser = Ex12ExRenEntryParser.FromBytes(this.GetLocationPropertyBag(context).TryGetProperty(this.Property) as byte[]);

            ex12ExRenEntryParser.Insert(this.persistenceId, entryId);
            base.SetEntryId(context, ex12ExRenEntryParser.ToBytes());
        }
Exemplo n.º 9
0
        internal override bool EnsureIsValid(DefaultFolderContext context, Folder folder)
        {
            FromFavoriteSendersFolderValidation.Tracer.TraceFunction((long)this.GetHashCode(), "Entering FromFavoriteSendersFolderValidation.EnsureIsValid");
            if (!base.EnsureIsValid(context, folder))
            {
                FromFavoriteSendersFolderValidation.Tracer.TraceFunction((long)this.GetHashCode(), "Exiting FromFavoriteSendersFolderValidation.EnsureIsValid:  folder failed base class validation.");
                return(false);
            }
            SearchFolder searchFolder = folder as SearchFolder;

            if (searchFolder == null)
            {
                FromFavoriteSendersFolderValidation.Tracer.TraceFunction((long)this.GetHashCode(), "Exiting FromFavoriteSendersFolderValidation.Validate:  not a SearchFolder instance.");
                return(false);
            }
            SearchFolderCriteria searchFolderCriteria = SearchFolderValidation.TryGetSearchCriteria(searchFolder);
            SearchFolderCriteria searchCriteria       = FromFavoriteSendersFolderValidation.GetSearchCriteria(context);

            if (searchFolderCriteria == null || !SearchFolderValidation.MatchSearchFolderCriteria(searchFolderCriteria, searchCriteria) || searchFolderCriteria.DeepTraversal != searchCriteria.DeepTraversal)
            {
                FromFavoriteSendersFolderValidation.Tracer.TraceDebug((long)this.GetHashCode(), "Current criteria are NOT initialized or don't match desired criteria.  Updating.");
                searchFolder.ApplyContinuousSearch(searchCriteria);
            }
            FromFavoriteSendersFolderValidation.Tracer.TraceFunction((long)this.GetHashCode(), "Exiting FromFavoriteSendersFolderValidation.EnsureIsValid.  Validation is done.");
            return(true);
        }
Exemplo n.º 10
0
        internal DefaultFolder(DefaultFolderContext context, DefaultFolderInfo defaultFolderInfo, CultureInfo cultureInfo, MailboxSessionSharableDataManager sharableDataManager, DefaultFolderType defaultFolderType, bool deferInitialize, bool forceInitialize)
        {
            bool flag = (defaultFolderInfo.Behavior & DefaultFolderBehavior.AlwaysDeferInitialization) == DefaultFolderBehavior.AlwaysDeferInitialization;

            this.sharableDataManager = sharableDataManager;
            this.defaultFolderType   = defaultFolderType;
            this.defaultFolderInfo   = defaultFolderInfo;
            this.context             = context;
            this.cultureInfo         = cultureInfo;
            DefaultFolderData defaultFolderData  = this.GetDefaultFolderData();
            DefaultFolderData defaultFolderData2 = defaultFolderData ?? new DefaultFolderData(false);

            if (!this.context.DeferFolderIdInit && !defaultFolderData2.IdInitialized)
            {
                defaultFolderData2 = this.InitializeFolderIdPrivate();
            }
            if (forceInitialize || (!flag && !deferInitialize))
            {
                this.InitializeDefaultFolderIfNeeded(ref defaultFolderData2);
                if (this.GetDefaultFolderData().FolderId == null)
                {
                    ExTraceGlobals.DefaultFoldersTracer.TraceDebug <DefaultFolderInfo>((long)this.GetHashCode(), "DefaultFolder::Ctor. Cannot find the Id of the DefaultFolder. DefaultFolder = {0}.", this.defaultFolderInfo);
                }
            }
            if (defaultFolderData != defaultFolderData2)
            {
                this.SetDefaultFolderData(defaultFolderData2);
            }
        }
 internal override void SetEntryId(DefaultFolderContext context, byte[] entryId)
 {
     if (!Utils.IsTeamMailbox(context.Session))
     {
         base.SetEntryId(context, entryId);
     }
 }
Exemplo n.º 12
0
        internal static PropertyError UpdateElcRootFolderName(DefaultFolderContext context, string newName)
        {
            PropertyError result        = null;
            StoreObjectId storeObjectId = context[DefaultFolderType.ElcRoot];

            if (storeObjectId != null)
            {
                using (MapiPropertyBag mapiPropertyBag = MapiPropertyBag.CreateMapiPropertyBag(context.Session, storeObjectId))
                {
                    PropertyDefinition[] propertyDefinitions = new PropertyDefinition[]
                    {
                        FolderSchema.DisplayName
                    };
                    PropertyError[] array = mapiPropertyBag.SetProperties(propertyDefinitions, new object[]
                    {
                        newName
                    });
                    if (array.Length > 0)
                    {
                        result = array[0];
                    }
                    mapiPropertyBag.SaveChanges(false);
                    return(result);
                }
            }
            throw new ObjectNotFoundException(ServerStrings.ExDefaultFolderNotFound(DefaultFolderType.ElcRoot));
        }
        protected override void SetPropertiesInternal(DefaultFolderContext context, Folder folder)
        {
            base.SetPropertiesInternal(context, folder);
            folder.Save();
            SearchFolder searchFolder = (SearchFolder)folder;

            StoreObjectId[] folderScope;
            if (MailboxSession.DefaultFoldersToForceInit != null && MailboxSession.DefaultFoldersToForceInit.Contains(DefaultFolderType.MyContacts))
            {
                folderScope = this.contactsSearchFolderCriteria.GetExistingDefaultFolderScope(context);
            }
            else
            {
                folderScope = this.contactsSearchFolderCriteria.GetDefaultFolderScope(context.Session, true);
            }
            SearchFolderCriteria searchFolderCriteria = ContactsSearchFolderCriteria.CreateSearchCriteria(folderScope);

            ContactsSearchFolderCriteria.ApplyContinuousSearchFolderCriteria(XSOFactory.Default, context.Session, searchFolder, searchFolderCriteria);
            bool flag = context.Session.MailboxOwner.RecipientTypeDetails != RecipientTypeDetails.GroupMailbox || !context.Session.ClientInfoString.Contains("Client=WebServices;Action=ConfigureGroupMailbox");

            MyContactsFolderValidation.Tracer.TraceDebug <string, RecipientTypeDetails, bool>((long)context.Session.GetHashCode(), "SearchFolder criteria applied. ClientInfoString={0}, RecipientTypeDetails={1}, ShouldWaitForNotification={2}", context.Session.ClientInfoString, context.Session.MailboxOwner.RecipientTypeDetails, flag);
            if (flag)
            {
                ContactsSearchFolderCriteria.WaitForSearchFolderPopulation(XSOFactory.Default, context.Session, searchFolder);
            }
            folder.Load(null);
        }
Exemplo n.º 14
0
        internal override byte[] GetEntryId(DefaultFolderContext context)
        {
            StoreSession session = context.Session;
            bool         flag    = false;

            byte[] result;
            try
            {
                if (session != null)
                {
                    session.BeginMapiCall();
                    session.BeginServerHealthCall();
                    flag = true;
                }
                if (StorageGlobals.MapiTestHookBeforeCall != null)
                {
                    StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                }
                result = this.getFreeId(context.Session);
            }
            catch (MapiPermanentException ex)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotOpenFolder, ex, session, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("FreeEntryIdStrategy::GetEntryId. Hit exception when adding ``free'' default folders.", new object[0]),
                    ex
                });
            }
            catch (MapiRetryableException ex2)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotOpenFolder, ex2, session, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("FreeEntryIdStrategy::GetEntryId. Hit exception when adding ``free'' default folders.", new object[0]),
                    ex2
                });
            }
            finally
            {
                try
                {
                    if (session != null)
                    {
                        session.EndMapiCall();
                        if (flag)
                        {
                            session.EndServerHealthCall();
                        }
                    }
                }
                finally
                {
                    if (StorageGlobals.MapiTestHookAfterCall != null)
                    {
                        StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                    }
                }
            }
            return(result);
        }
 internal override byte[] GetEntryId(DefaultFolderContext context)
 {
     if (!Utils.IsTeamMailbox(context.Session))
     {
         return(base.GetEntryId(context));
     }
     return(null);
 }
Exemplo n.º 16
0
 public override bool Validate(DefaultFolderContext context, PropertyBag propertyBag)
 {
     if (!base.Validate(context, propertyBag))
     {
         throw new DefaultFolderPropertyValidationException(ServerStrings.MatchContainerClassValidationFailed);
     }
     return(true);
 }
        internal override FolderSaveResult UnsetEntryId(DefaultFolderContext context)
        {
            Ex12ExRenEntryParser ex12ExRenEntryParser = Ex12ExRenEntryParser.FromBytes(this.GetLocationPropertyBag(context).TryGetProperty(this.Property) as byte[]);

            ex12ExRenEntryParser.Remove(this.persistenceId);
            base.SetEntryId(context, ex12ExRenEntryParser.ToBytes());
            return(FolderPropertyBag.SuccessfulSave);
        }
Exemplo n.º 18
0
        protected override void SetPropertiesInternal(DefaultFolderContext context, Folder folder)
        {
            base.SetPropertiesInternal(context, folder);
            folder.Save();
            SearchFolder searchFolder = (SearchFolder)folder;

            searchFolder.ApplyContinuousSearch(this.CreateSearchCriteria(context));
            folder.Load(null);
        }
Exemplo n.º 19
0
        private void CacheDefaultFoldersFromSharedDataManager(DefaultFolderContext context)
        {
            CultureInfo defaultFoldersCulture = context.Session.SharedDataManager.DefaultFoldersCulture;

            foreach (DefaultFolderType defaultFolderType in DefaultFolderManager.defaultFolderInitializationOrder)
            {
                this.defaultFolders[(int)defaultFolderType] = new DefaultFolder(context, DefaultFolderInfo.Instance[(int)defaultFolderType], defaultFoldersCulture, this.session.SharedDataManager, defaultFolderType, false, false);
            }
        }
Exemplo n.º 20
0
        protected override void SetPropertiesInternal(DefaultFolderContext context, Folder folder)
        {
            base.SetPropertiesInternal(context, folder);
            SearchFolder searchFolder = (SearchFolder)folder;

            searchFolder.Save();
            searchFolder.ApplyContinuousSearch(CalendarVersionStoreValidation.CreateCalendarVersionSearchCriteria(context));
            searchFolder.Load();
        }
        internal override bool EnsureIsValid(DefaultFolderContext context, StoreObjectId folderId, Dictionary <string, DefaultFolderManager.FolderData> folderDataDictionary)
        {
            if (!base.EnsureIsValid(context, folderId, folderDataDictionary))
            {
                return(false);
            }
            string idString = Convert.ToBase64String(folderId.ProviderLevelItemId);

            return(base.BindAndValidateFolder(context, folderId, idString));
        }
Exemplo n.º 22
0
 private SearchFolderCriteria CreateSearchCriteria(DefaultFolderContext context)
 {
     return(new SearchFolderCriteria(AllContactsFolderValidation.GetQueryFilter(context), new StoreId[]
     {
         context[DefaultFolderType.Root]
     })
     {
         DeepTraversal = true
     });
 }
Exemplo n.º 23
0
        internal override bool EnsureIsValid(DefaultFolderContext context, Folder folder)
        {
            if (!base.EnsureIsValid(context, folder.PropertyBag))
            {
                return(false);
            }
            StoreObjectId storeObjectId = context[this.parentFolderType];

            return(storeObjectId == null || storeObjectId.Equals(folder.ParentId));
        }
Exemplo n.º 24
0
        private bool ValidateUMFaxFilter(DefaultFolderContext context, OutlookSearchFolder folder)
        {
            SearchFolderCriteria searchFolderCriteria = SearchFolderValidation.TryGetSearchCriteria(folder);

            if (searchFolderCriteria == null || !UMFaxValidation.GetUMFaxQueryFilter(context).Equals(searchFolderCriteria.SearchQuery))
            {
                folder.ApplyContinuousSearch(UMFaxValidation.CreateUMFaxSearchCriteria(context));
            }
            return(true);
        }
Exemplo n.º 25
0
        protected override void SetPropertiesInternal(DefaultFolderContext context, Folder folder)
        {
            base.SetPropertiesInternal(context, folder);
            SearchFolder searchFolder = (SearchFolder)folder;

            searchFolder.Save();
            searchFolder.Load(null);
            AllItemsFolderHelper.InitializeTransportIndexes(folder);
            AllItemsFolderValidation.TryApplyContinuousSearch(searchFolder, AllItemsFolderValidation.CreateSearchCriteria(context));
        }
Exemplo n.º 26
0
 private static SearchFolderCriteria CreateUMVoiceMailSearchCriteria(DefaultFolderContext context)
 {
     return(new SearchFolderCriteria(UMVoiceMailValidation.GetUMVoicemailQueryFilter(context), new StoreId[]
     {
         context[DefaultFolderType.Root]
     })
     {
         DeepTraversal = true
     });
 }
Exemplo n.º 27
0
        internal override bool EnsureIsValid(DefaultFolderContext context, Folder folder)
        {
            if (!base.EnsureIsValid(context, folder))
            {
                return(false);
            }
            OutlookSearchFolder outlookSearchFolder = folder as OutlookSearchFolder;

            return(outlookSearchFolder != null && this.ValidateUMVoiceMailFilter(context, outlookSearchFolder));
        }
Exemplo n.º 28
0
 private static SearchFolderCriteria CreateSearchCriteria(DefaultFolderContext context)
 {
     return(new SearchFolderCriteria(new ExistsFilter(InternalSchema.ItemClass), new StoreId[]
     {
         context.Session.GetDefaultFolderId(DefaultFolderType.Root)
     })
     {
         DeepTraversal = true
     });
 }
Exemplo n.º 29
0
 internal static SearchFolderCriteria CreateUMFaxSearchCriteria(DefaultFolderContext context)
 {
     return(new SearchFolderCriteria(UMFaxValidation.GetUMFaxQueryFilter(context), new StoreId[]
     {
         context[DefaultFolderType.Inbox]
     })
     {
         DeepTraversal = true
     });
 }
Exemplo n.º 30
0
        private StoreObjectId GetFolderId(DefaultFolderContext context, DefaultFolderType folderType)
        {
            StoreObjectId storeObjectId = context[folderType];

            if (storeObjectId == null)
            {
                throw new ObjectNotFoundException(ServerStrings.ExDefaultFolderNotFound(folderType));
            }
            return(storeObjectId);
        }