internal ADUser ResolveUser(RecipientIdParameter id, out Exception exception) { this.AddVerboseLog("Start: ResolveUser"); if (id == null) { throw new ArgumentNullException("id"); } ADUser user; if (this.resolveUserCache.TryGetValue(id.RawIdentity, out user)) { exception = null; return(user); } exception = GroupMailboxContext.ExecuteADOperationAndHandleException(delegate { user = (ADUser)this.getUserDataObject(id, this.adSession, this.currentOrganizationId.OrganizationalUnit, null, new LocalizedString?(Strings.ErrorRecipientNotFound((string)id)), new LocalizedString?(Strings.ErrorRecipientNotUnique((string)id)), ExchangeErrorCategory.Client); }); Guid guid; if (exception is ManagementObjectNotFoundException && Guid.TryParse(id.RawIdentity, out guid)) { GroupMailboxContext.ExecuteADOperationAndHandleException(delegate { user = this.adSession.FindADUserByExternalDirectoryObjectId(id.RawIdentity); }); if (user != null) { exception = null; } } if (exception == null && user != null) { this.resolveUserCache.Add(id.RawIdentity, user); } this.AddVerboseLog("End: ResolveUser"); return(user); }
internal void EnsureGroupIsInDirectoryCache(string perfTrackerPrefix) { string message = GroupMailboxContext.EnsureGroupIsInDirectoryCache(perfTrackerPrefix, this.adSession, this.groupMailbox); this.AddVerboseLog(message); }