Example #1
0
        public static SearchFolder Bind(MailboxSession session, DefaultFolderType defaultFolderType, ICollection <PropertyDefinition> propsToReturn)
        {
            EnumValidator.ThrowIfInvalid <DefaultFolderType>(defaultFolderType, "defaultFolderType");
            DefaultFolder defaultFolder = session.InternalGetDefaultFolder(defaultFolderType);

            if (defaultFolder.StoreObjectType != StoreObjectType.OutlookSearchFolder && defaultFolder.StoreObjectType != StoreObjectType.SearchFolder)
            {
                throw new ArgumentOutOfRangeException("defaultFolderType");
            }
            StoreObjectId           folderId = session.SafeGetDefaultFolderId(defaultFolderType);
            ObjectNotFoundException ex       = null;

            for (int i = 0; i < 2; i++)
            {
                try
                {
                    return(SearchFolder.Bind(session, folderId, propsToReturn));
                }
                catch (ObjectNotFoundException ex2)
                {
                    ex = ex2;
                    ExTraceGlobals.StorageTracer.Information <DefaultFolderType>(0L, "SearchFolder::Bind(defaultFolderType): attempting to recreate {0}.", defaultFolderType);
                    if (!session.TryFixDefaultFolderId(defaultFolderType, out folderId))
                    {
                        throw;
                    }
                }
            }
            throw ex;
        }
        public static G RunQueryOnAllItemsFolder <G>(MailboxSession session, AllItemsFolderHelper.SupportedSortBy supportedSortBy, AllItemsFolderHelper.DoQueryProcessing <G> queryProcessor, ICollection <PropertyDefinition> properties, ItemQueryType itemQueryType)
        {
            AllItemsFolderHelper.CheckAndCreateDefaultFolders(session);
            G result;

            using (SearchFolder searchFolder = SearchFolder.Bind(session, DefaultFolderType.AllItems))
            {
                using (QueryResult queryResult = searchFolder.ItemQuery(itemQueryType, null, AllItemsFolderHelper.sortOrderMap[supportedSortBy], properties))
                {
                    result = queryProcessor(queryResult);
                }
            }
            return(result);
        }
Example #3
0
        private static SearchFolder BindExistingFilteredViewSearchFolder(StoreId searchFolderId, MailboxSession mailboxSession, OwaSearchContext searchContext)
        {
            SearchFolder result = null;

            try
            {
                result = SearchFolder.Bind(mailboxSession, searchFolderId, OwaFilterState.FolderQueryProperties);
            }
            catch (ObjectNotFoundException)
            {
                searchContext.ViewFilterActions |= ViewFilterActions.ObjectNotFoundException;
                string message = string.Format("[OwaFilterState::BindExistingFilteredViewSearchFolder] Attempt to bind to search folder failed {0}. ViewFilterActions: {1}", searchFolderId.ToString(), (int)searchContext.ViewFilterActions);
                ExTraceGlobals.StorageTracer.TraceDebug(0L, message);
            }
            return(result);
        }
Example #4
0
 public static SearchFolder Bind(MailboxSession session, DefaultFolderType defaultFolderType)
 {
     return(SearchFolder.Bind(session, defaultFolderType, null));
 }
Example #5
0
 public new static SearchFolder Bind(StoreSession session, StoreId folderId, params PropertyDefinition[] propsToReturn)
 {
     return(SearchFolder.Bind(session, folderId, (ICollection <PropertyDefinition>)propsToReturn));
 }
Example #6
0
 public new static SearchFolder Bind(StoreSession session, StoreId folderId)
 {
     return(SearchFolder.Bind(session, folderId, null));
 }
Example #7
0
 public ISearchFolder BindToSearchFolder(IStoreSession session, StoreId folderId)
 {
     return(SearchFolder.Bind((StoreSession)session, folderId));
 }
Example #8
0
 public ISearchFolder BindToSearchFolder(IMailboxSession session, DefaultFolderType defaultFolderType)
 {
     return(SearchFolder.Bind((MailboxSession)session, defaultFolderType));
 }