Example #1
0
        public OABCache.OABCacheEntry GetOABFromCacheOrAD(Guid exchangeObjectId, string userAcceptedDomain)
        {
            OABCache.OABCacheEntry oabcacheEntry = null;
            if (this.oabTimeoutCache.TryGetValue(exchangeObjectId, out oabcacheEntry))
            {
                return(oabcacheEntry);
            }
            IConfigurationSession configurationSessionFromDomain = DirectoryHelper.GetConfigurationSessionFromDomain(userAcceptedDomain);
            OfflineAddressBook    offlineAddressBook             = configurationSessionFromDomain.FindByExchangeObjectId <OfflineAddressBook>(exchangeObjectId);

            if (offlineAddressBook == null)
            {
                throw new ADNoSuchObjectException(new LocalizedString(exchangeObjectId.ToString()));
            }
            oabcacheEntry = new OABCache.OABCacheEntry(offlineAddressBook);
            this.oabTimeoutCache.TryInsertAbsolute(exchangeObjectId, oabcacheEntry, OABCache.cacheTimeToLive.Value);
            return(oabcacheEntry);
        }