internal static void WarnForNoDistribution(OfflineAddressBook dataObject, Task.TaskWarningLoggingDelegate warningHandler) { if (!dataObject.PublicFolderDistributionEnabled && !dataObject.WebDistributionEnabled) { warningHandler(Strings.WarningOABWithoutDistribution); } }
protected override void InternalValidate() { this.DataObject = (AddressBookMailboxPolicy)base.PrepareDataObject(); this.DataObject.SetExchangeVersion(ExchangeObjectVersion.Exchange2010); this.DataObject.MinAdminVersion = new int?(this.DataObject.ExchangeVersion.ExchangeBuild.ToExchange2003FormatInt32()); int maxAddressBookPolicies = this.MaxAddressBookPolicies; if (maxAddressBookPolicies < 2147483647) { IEnumerable <AddressBookMailboxPolicy> enumerable = base.DataSession.FindPaged <AddressBookMailboxPolicy>(null, ((IConfigurationSession)base.DataSession).GetOrgContainerId().GetDescendantId(this.DataObject.ParentPath), false, null, ADGenericPagedReader <AddressBookMailboxPolicy> .DefaultPageSize); int num = 0; foreach (AddressBookMailboxPolicy addressBookMailboxPolicy in enumerable) { num++; if (num >= maxAddressBookPolicies) { base.WriteError(new ManagementObjectAlreadyExistsException(Strings.ErrorTooManyItems(maxAddressBookPolicies)), ErrorCategory.LimitsExceeded, base.Name); break; } } } this.DataObject.AddressLists = AddressBookPolicyTaskUtility.ValidateAddressBook(base.DataSession, this.AddressLists, new AddressBookPolicyTaskUtility.GetUniqueObject(base.GetDataObject <AddressBookBase>), this.DataObject, new Task.TaskErrorLoggingDelegate(base.WriteError)); AddressBookBase addressBookBase = (AddressBookBase)base.GetDataObject <AddressBookBase>(this.GlobalAddressList, base.DataSession, null, new LocalizedString?(Strings.ErrorAddressListOrGlobalAddressListNotFound(this.GlobalAddressList.ToString())), new LocalizedString?(Strings.ErrorAddressListOrGlobalAddressListNotUnique(this.GlobalAddressList.ToString()))); if (addressBookBase != null && addressBookBase.IsGlobalAddressList) { this.DataObject.GlobalAddressList = (ADObjectId)addressBookBase.Identity; } else { base.WriteError(new ArgumentException(Strings.ErrorGlobalAddressListNotFound(this.GlobalAddressList.ToString())), ErrorCategory.InvalidArgument, base.Name); this.DataObject.GlobalAddressList = null; } AddressBookBase addressBookBase2 = (AddressBookBase)base.GetDataObject <AddressBookBase>(this.RoomList, base.DataSession, null, new LocalizedString?(Strings.ErrorAllRoomListNotFound(this.RoomList.ToString())), new LocalizedString?(Strings.ErrorAllRoomListNotUnique(this.RoomList.ToString()))); if (addressBookBase2 != null) { this.DataObject.RoomList = (ADObjectId)addressBookBase2.Identity; } else { base.WriteError(new ArgumentException(Strings.ErrorAllRoomListNotFound(this.RoomList.ToString())), ErrorCategory.InvalidArgument, base.Name); this.DataObject.RoomList = null; } OfflineAddressBook offlineAddressBook = (OfflineAddressBook)base.GetDataObject <OfflineAddressBook>(this.OfflineAddressBook, base.DataSession, null, new LocalizedString?(Strings.ErrorOfflineAddressBookNotFound(this.OfflineAddressBook.ToString())), new LocalizedString?(Strings.ErrorOfflineAddressBookNotUnique(this.OfflineAddressBook.ToString()))); if (offlineAddressBook != null) { this.DataObject.OfflineAddressBook = (ADObjectId)offlineAddressBook.Identity; } else { base.WriteError(new ArgumentException(Strings.ErrorOfflineAddressBookNotFound(this.OfflineAddressBook.ToString())), ErrorCategory.InvalidArgument, base.Name); this.DataObject.OfflineAddressBook = null; } ReadOnlyCollection <PropertyDefinition> allProperties = this.DataObject.Schema.AllProperties; base.InternalValidate(); }
internal OABCacheEntry(OfflineAddressBook oab) { this.exchangeVersion = oab.ExchangeVersion; this.virtualDirectories = oab.VirtualDirectories; this.globalWebDistributionEnabled = oab.GlobalWebDistributionEnabled; this.generatingMailbox = oab.GeneratingMailbox; this.shadowMailboxDistributionEnabled = oab.ShadowMailboxDistributionEnabled; }
protected override void InternalValidate() { TaskLogger.LogEnter(); base.InternalValidate(); if (base.HasErrors) { return; } AddressBookMailboxPolicy dataObject = this.DataObject; if (this.AddressLists != null && this.AddressLists.Length > 0) { dataObject.AddressLists = AddressBookPolicyTaskUtility.ValidateAddressBook(base.DataSession, this.AddressLists, new AddressBookPolicyTaskUtility.GetUniqueObject(base.GetDataObject <AddressBookBase>), dataObject, new Task.TaskErrorLoggingDelegate(base.WriteError)); } if (base.Fields.IsModified(AddressBookMailboxPolicySchema.GlobalAddressList) && this.GlobalAddressList != null) { AddressBookBase addressBookBase = (AddressBookBase)base.GetDataObject <AddressBookBase>(this.GlobalAddressList, base.DataSession, null, new LocalizedString?(Strings.ErrorAddressListOrGlobalAddressListNotFound(this.GlobalAddressList.ToString())), new LocalizedString?(Strings.ErrorAddressListOrGlobalAddressListNotUnique(this.GlobalAddressList.ToString()))); if (addressBookBase.IsGlobalAddressList) { dataObject.GlobalAddressList = (ADObjectId)addressBookBase.Identity; } else { base.WriteError(new ArgumentException(Strings.ErrorGlobalAddressListNotFound(this.GlobalAddressList.ToString())), ErrorCategory.InvalidArgument, this.Identity); dataObject.GlobalAddressList = null; } } if (base.Fields.IsModified(AddressBookMailboxPolicySchema.RoomList) && this.RoomList != null) { AddressBookBase addressBookBase2 = (AddressBookBase)base.GetDataObject <AddressBookBase>(this.RoomList, base.DataSession, null, new LocalizedString?(Strings.ErrorAllRoomListNotFound(this.RoomList.ToString())), new LocalizedString?(Strings.ErrorAllRoomListNotUnique(this.RoomList.ToString()))); if (addressBookBase2 != null) { dataObject.RoomList = (ADObjectId)addressBookBase2.Identity; } else { base.WriteError(new ArgumentException(Strings.ErrorAllRoomListNotFound(this.RoomList.ToString())), ErrorCategory.InvalidArgument, this.Identity); dataObject.RoomList = null; } } if (base.Fields.IsModified(AddressBookMailboxPolicySchema.OfflineAddressBook)) { if (this.OfflineAddressBook != null) { OfflineAddressBook offlineAddressBook = (OfflineAddressBook)base.GetDataObject <OfflineAddressBook>(this.OfflineAddressBook, base.DataSession, null, new LocalizedString?(Strings.ErrorOfflineAddressBookNotFound(this.OfflineAddressBook.ToString())), new LocalizedString?(Strings.ErrorOfflineAddressBookNotUnique(this.OfflineAddressBook.ToString()))); dataObject.OfflineAddressBook = (ADObjectId)offlineAddressBook.Identity; } else { dataObject.OfflineAddressBook = null; } } TaskLogger.LogExit(); }
// Token: 0x06001251 RID: 4689 RVA: 0x00069774 File Offset: 0x00067974 private Queue <OfflineAddressBook> GetOABsFromAD(OABGeneratorTaskContext context, Guid oabObjectGuid) { OABGeneratorAssistant.Tracer.TraceFunction <Guid>((long)this.GetHashCode(), "GetOABsFromAD. oabObjectGuid={0}", oabObjectGuid); Queue <OfflineAddressBook> queue = new Queue <OfflineAddressBook>(); if (oabObjectGuid == Guid.Empty) { OfflineAddressBook[] array = this.GetCandidateOABsFromAD(context) ?? new OfflineAddressBook[0]; OABLogger.LogRecord(TraceType.InfoTrace, "OABGeneratorAssistant.GetCandidateOABSFromAD() returned {0} oab(s)", new object[] { array.Length.ToString() }); foreach (OfflineAddressBook offlineAddressBook in array) { if (!this.OABAddressListsAreValid(offlineAddressBook)) { OABLogger.LogRecord(TraceType.ErrorTrace, "OABGeneratorAssistant.GetOABsFromAD: address list is invalid: {0}.", new object[] { offlineAddressBook.Id }); } else if (this.isRunningFromInvoke) { queue.Enqueue(offlineAddressBook); } else if (OABVariantConfigurationSettings.IsGenerateRequestedOABsOnlyEnabled && (offlineAddressBook.LastRequestedTime == null || DateTime.UtcNow - offlineAddressBook.LastRequestedTime.Value >= Globals.LastRequestedTimeGenerationWindow)) { OABLogger.LogRecord(TraceType.ErrorTrace, "OABGeneratorAssistant.GetOABsFromAD: LastRequestedTime for OAB {0} is beyond generation window - LastRequestedTime: {1}, LastRequestedTimeWindow: {2}", new object[] { offlineAddressBook.Id, (offlineAddressBook.LastRequestedTime != null) ? offlineAddressBook.LastRequestedTime.Value.ToString() : "null", Globals.LastRequestedTimeGenerationWindow }); } else { queue.Enqueue(offlineAddressBook); } } } else { OfflineAddressBook specificOABFromAD = this.GetSpecificOABFromAD(context, oabObjectGuid); if (specificOABFromAD != null && this.OABAddressListsAreValid(specificOABFromAD)) { queue.Enqueue(specificOABFromAD); } } OABLogger.LogRecord(TraceType.InfoTrace, "OABGeneratorAssistant.GetOABsFromAD() returned {0} oab(s)", new object[] { queue.Count }); return(queue); }
internal static OfflineAddressBook ResetOldDefaultOab(IConfigDataProvider session, Task.TaskErrorLoggingDelegate errorHandler) { OfflineAddressBook offlineAddressBook = null; QueryFilter filter = new ComparisonFilter(ComparisonOperator.Equal, OfflineAddressBookSchema.IsDefault, true); IConfigurable[] array = session.Find <OfflineAddressBook>(filter, null, true, null); if (array.Length > 0) { offlineAddressBook = (OfflineAddressBook)array[0]; offlineAddressBook.IsDefault = false; session.Save(offlineAddressBook); } return(offlineAddressBook); }
// Token: 0x06000112 RID: 274 RVA: 0x00007060 File Offset: 0x00005260 private static OfflineAddressBookCacheEntry FindOab(ADObjectId rootId, QueryFilter filter, IConfigurationSession session) { IEnumerable <OfflineAddressBook> enumerable = session.FindPaged <OfflineAddressBook>(rootId, QueryScope.SubTree, filter, null, 0); OfflineAddressBook oab = null; using (IEnumerator <OfflineAddressBook> enumerator = enumerable.GetEnumerator()) { if (enumerator.MoveNext()) { OfflineAddressBook offlineAddressBook = enumerator.Current; oab = offlineAddressBook; } } return(OfflineAddressBookCacheEntry.Create(oab)); }
// Token: 0x06001209 RID: 4617 RVA: 0x0003817C File Offset: 0x0003637C internal static Server FindMailboxServer(string domainController, OfflineAddressBook currentOABSettings, LogMessageDelegate logger) { ITopologyConfigurationSession topologyConfigurationSession = PhysicalResourceLoadBalancing.CreateGlobalConfigSession(domainController); QueryFilter filter = new AndFilter(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.GreaterThanOrEqual, ServerSchema.VersionNumber, Server.E14MinVersion), new BitMaskAndFilter(ServerSchema.CurrentServerRole, 2UL), new ComparisonFilter(ComparisonOperator.Equal, ActiveDirectoryServerSchema.IsExcludedFromProvisioning, false) }); PhysicalResourceLoadBalancing.LogVerbose(TaskVerboseStringHelper.GetFindDataObjectsVerboseString(topologyConfigurationSession, typeof(Server), filter, null, true), logger); ADPagedReader <Server> adpagedReader = topologyConfigurationSession.FindPaged <Server>(null, QueryScope.SubTree, filter, null, 0); List <Server> list = new List <Server>(); foreach (Server server in adpagedReader) { PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbFoundMailboxServer(server.Identity.ToString()), logger); list.Add(server); } if (currentOABSettings.Server != null) { Server currentOABServer = topologyConfigurationSession.Read <Server>(currentOABSettings.Server); PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbOABIsCurrentlyOnServer((currentOABServer == null) ? Strings.VerboseLbDeletedServer : currentOABServer.Identity.ToString()), logger); if (currentOABServer != null && list.Find((Server s) => ADObjectId.Equals(s.Id, currentOABServer.Id)) != null) { if (list.Count == 1) { PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbOnlyOneEligibleServer(currentOABServer.Identity.ToString()), logger); return(currentOABServer); } list.RemoveAll((Server s) => ADObjectId.Equals(s.Id, currentOABServer.Id)); } } if (list.Count == 0) { PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbNoEligibleServers, logger); return(null); } if (list.Count == 1) { return(list[0]); } Random random = new Random(); Server server2 = list[random.Next(0, list.Count)]; PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbReturningServer(server2.Identity.ToString()), logger); return(server2); }
// Token: 0x06000266 RID: 614 RVA: 0x0000C118 File Offset: 0x0000A318 public OABCache.OABCacheEntry GetOABFromCacheOrAD(Guid exchangeObjectId, string userAcceptedDomain) { OABCache.OABCacheEntry oabcacheEntry = null; if (this.oabTimeoutCache.TryGetValue(exchangeObjectId, ref oabcacheEntry)) { return(oabcacheEntry); } OfflineAddressBook offlineAddressBook = DirectoryHelper.GetConfigurationSessionFromExchangeGuidAndDomain(exchangeObjectId, userAcceptedDomain).FindByExchangeObjectId <OfflineAddressBook>(exchangeObjectId, "d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\Cache\\OABCache.cs", 115, "GetOABFromCacheOrAD"); 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); }
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); }
// Token: 0x0600011E RID: 286 RVA: 0x00007228 File Offset: 0x00005428 private OfflineAddressBookCacheEntry(OfflineAddressBook oab) { this.hasValue = (oab != null); if (this.hasValue) { this.webDistributionEnabled = oab.WebDistributionEnabled; this.globalWebDistributionEnabled = oab.GlobalWebDistributionEnabled; this.id = oab.Id; this.distinguishedName = oab.Id.DistinguishedName; this.exchangeObjectId = oab.ExchangeObjectId; this.exchangeVersion = oab.ExchangeVersion; this.isDefault = oab.IsDefault; if (this.isDefault) { this.configurationUnitId = oab.ConfigurationUnit; } } this.createdTime = DateTime.UtcNow; }
// Token: 0x0600136B RID: 4971 RVA: 0x000715A8 File Offset: 0x0006F7A8 public PropertyManager(OfflineAddressBook offlineAddressBook, SecurityIdentifier userSid, string userDomain, bool habEnabled) { PropertyManager.Tracer.TraceFunction((long)this.GetHashCode(), "PropertyManager.PropertyManager"); Dictionary <PropTag, OABPropertyFlags> dictionary = new Dictionary <PropTag, OABPropertyFlags>(); PropertyManager.AddProperties("RdnProperties", PropertyManager.RdnProperties, OABPropertyFlags.RDN, dictionary); PropertyManager.AddProperties("OfflineAddressBookSchema.ANRProperties", PropertyManager.GetPropTagArray(offlineAddressBook[OfflineAddressBookSchema.ANRProperties]), OABPropertyFlags.ANR, dictionary); PropertyManager.AddProperties("OfflineAddressBookSchema.DetailsProperties", PropertyManager.GetPropTagArray(offlineAddressBook[OfflineAddressBookSchema.DetailsProperties]), OABPropertyFlags.None, dictionary); if (habEnabled) { PropertyManager.AddProperties("HABProperties", PropertyManager.habProperties, OABPropertyFlags.None, dictionary); } PropertyManager.AddProperties("OfflineAddressBookSchema.TruncatedProperties", PropertyManager.GetPropTagArray(offlineAddressBook[OfflineAddressBookSchema.TruncatedProperties]), OABPropertyFlags.Truncated, dictionary); PropertyManager.AddProperties("RequiredProperties", PropertyManager.RequiredProperties, OABPropertyFlags.None, dictionary); foreach (PropTag key in PropertyManager.V4ANRPropTags) { OABPropertyFlags oabpropertyFlags; if (dictionary.TryGetValue(key, out oabpropertyFlags)) { dictionary[key] = (oabpropertyFlags | OABPropertyFlags.ANR); } } PropertyManager.InitializeNspiPropMapper(); this.oabProperties = OABProperty.CreateOABPropertyList(dictionary); SecurityAccessToken securityAccessToken = new SecurityAccessToken { UserSid = userSid.ToString() }; ClientSecurityContext clientSecurityContext = new ClientSecurityContext(securityAccessToken); this.nspiContext = new NspiContext(clientSecurityContext, userDomain, string.Empty, string.Empty, string.Empty, default(Guid)); if (!this.nspiContext.TryAcquireBudget()) { PropertyManager.Tracer.TraceError((long)this.GetHashCode(), "NspiContext.TryAcquireBudget failed"); } NspiState state = new NspiState { CodePage = Encoding.UTF8.CodePage }; this.nspiContext.Bind(NspiBindFlags.None, state); this.nspiPropMapper = new NspiPropMapper(this.nspiContext, Array.ConvertAll <OABProperty, PropTag>(this.oabProperties, (OABProperty property) => property.PropTag), Encoding.UTF8.CodePage, NspiPropMapperFlags.IncludeHiddenFromAddressListsEnabled); }
protected override void InternalBeginProcessing() { TaskLogger.LogEnter(); base.InternalBeginProcessing(); MailboxDatabase mailboxDatabase = (MailboxDatabase)this.GetDynamicParameters(); if (base.Fields.IsModified("PublicFolderDatabase")) { this.PublicFolderDatabase.AllowLegacy = true; PublicFolderDatabase publicFolderDatabase = (PublicFolderDatabase)base.GetDataObject <PublicFolderDatabase>(this.PublicFolderDatabase, base.GlobalConfigSession, null, new LocalizedString?(Strings.ErrorPublicFolderDatabaseNotFound(this.PublicFolderDatabase.ToString())), new LocalizedString?(Strings.ErrorPublicFolderDatabaseNotUnique(this.PublicFolderDatabase.ToString()))); mailboxDatabase.PublicFolderDatabase = (ADObjectId)publicFolderDatabase.Identity; } if (base.Fields.IsModified("OfflineAddressBook")) { if (this.OfflineAddressBook == null) { mailboxDatabase.OfflineAddressBook = null; } else { OfflineAddressBook offlineAddressBook = (OfflineAddressBook)base.GetDataObject <OfflineAddressBook>(this.OfflineAddressBook, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorOfflineAddressBookNotFound(this.OfflineAddressBook.ToString())), new LocalizedString?(Strings.ErrorOfflineAddressBookNotUnique(this.OfflineAddressBook.ToString()))); mailboxDatabase.OfflineAddressBook = (ADObjectId)offlineAddressBook.Identity; } } if (base.Fields.IsModified("JournalRecipient")) { if (this.JournalRecipient == null) { mailboxDatabase.JournalRecipient = null; } else { ADRecipient adrecipient = (ADRecipient)base.GetDataObject <ADRecipient>(this.JournalRecipient, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorRecipientNotFound(this.JournalRecipient.ToString())), new LocalizedString?(Strings.ErrorRecipientNotUnique(this.JournalRecipient.ToString()))); mailboxDatabase.JournalRecipient = (ADObjectId)adrecipient.Identity; } } if (base.Fields.IsModified(DatabaseSchema.MailboxProvisioningAttributes)) { mailboxDatabase.MailboxProvisioningAttributes = this.MailboxProvisioningAttributes; } TaskLogger.LogExit(); }
// Token: 0x06001253 RID: 4691 RVA: 0x00069994 File Offset: 0x00067B94 private OfflineAddressBook[] GetCandidateOABsFromAD(OABGeneratorTaskContext context) { if (!OABVariantConfigurationSettings.IsLinkedOABGenMailboxesEnabled) { QueryFilter filter = OABGeneratorAssistant.versionFilter; return(context.PerOrgAdSystemConfigSession.Find <OfflineAddressBook>(null, QueryScope.SubTree, filter, null, 0)); } if (context.OrganizationMailbox == null) { ADSessionSettings sessionSettings = OABVariantConfigurationSettings.IsMultitenancyEnabled ? ADSessionSettings.FromTenantPartitionHint(((OABGeneratorMailboxData)context.MailboxData).TenantPartitionHint) : ADSessionSettings.FromRootOrgScopeSet(); context.OrganizationMailbox = this.GetOrganizationalMailboxFromAD(sessionSettings, ((OABGeneratorMailboxData)context.MailboxData).Guid); } if (context.OrganizationMailbox.GeneratedOfflineAddressBooks != null && context.OrganizationMailbox.GeneratedOfflineAddressBooks.Count > 0) { OABLogger.LogRecord(TraceType.InfoTrace, "OABGeneratorAssistant.GetCandidateOABsFromAD: Found {0} generated offline address books in org mailbox {1}", new object[] { context.OrganizationMailbox.GeneratedOfflineAddressBooks.Count.ToString(), context.OrganizationMailbox.Id }); List <OfflineAddressBook> list = new List <OfflineAddressBook>(context.OrganizationMailbox.GeneratedOfflineAddressBooks.Count); foreach (ADObjectId entryId in context.OrganizationMailbox.GeneratedOfflineAddressBooks) { OfflineAddressBook offlineAddressBook = context.PerOrgAdSystemConfigSession.Read <OfflineAddressBook>(entryId); if (offlineAddressBook != null) { list.Add(offlineAddressBook); } } return(list.ToArray()); } OABLogger.LogRecord(TraceType.InfoTrace, "OABGeneratorAssistant.GetCandidateOABsFromAD: No offline address books found in org mailbox {0}", new object[] { context.OrganizationMailbox.Id }); return(null); }
// Token: 0x06000ADB RID: 2779 RVA: 0x000233B8 File Offset: 0x000215B8 public OfflineAddressBookIdParameter(OfflineAddressBook offlineAddresss) : base(offlineAddresss.Id) { }
public static OfflineAddressBookCacheEntry Create(OfflineAddressBook oab) { return(new OfflineAddressBookCacheEntry(oab)); }
internal static MultiValuedProperty <ADObjectId> ValidateVirtualDirectory(IConfigDataProvider session, VirtualDirectoryIdParameter[] virtualDirectories, OfflineAddressBookTaskUtility.GetUniqueObject getOabVirtualDirectory, OfflineAddressBook target, Task.TaskErrorLoggingDelegate writeError) { MultiValuedProperty <ADObjectId> multiValuedProperty = new MultiValuedProperty <ADObjectId>(false, OfflineAddressBookSchema.VirtualDirectories, new object[0]); foreach (VirtualDirectoryIdParameter virtualDirectoryIdParameter in virtualDirectories) { if (virtualDirectoryIdParameter != null) { IConfigurable configurable = getOabVirtualDirectory(virtualDirectoryIdParameter, session, null, new LocalizedString?(Strings.OabVirtualDirectoryNotExisting(virtualDirectoryIdParameter.ToString())), new LocalizedString?(Strings.OabVirtualDirectoryAmbiguous(virtualDirectoryIdParameter.ToString()))); if (configurable != null) { if (multiValuedProperty.Contains((ADObjectId)configurable.Identity)) { writeError(new InvalidOperationException(Strings.ErrorOabVDirAlreadyAssigned((target.Identity != null) ? target.Identity.ToString() : target.Name, configurable.Identity.ToString())), ErrorCategory.InvalidOperation, target.Identity); } else { multiValuedProperty.Add((ADObjectId)configurable.Identity); } } } } return(multiValuedProperty); }
internal static MultiValuedProperty <ADObjectId> ValidateAddressBook(IConfigDataProvider session, AddressBookBaseIdParameter[] addressBooks, OfflineAddressBookTaskUtility.GetUniqueObject getAddressBook, OfflineAddressBook target, Task.TaskErrorLoggingDelegate writeError) { MultiValuedProperty <ADObjectId> multiValuedProperty = new MultiValuedProperty <ADObjectId>(false, OfflineAddressBookSchema.AddressLists, new object[0]); if (addressBooks != null) { foreach (AddressBookBaseIdParameter addressBookBaseIdParameter in addressBooks) { if (addressBookBaseIdParameter != null) { IConfigurable configurable = getAddressBook(addressBookBaseIdParameter, session, null, new LocalizedString?(Strings.ErrorAddressListOrGlobalAddressListNotFound(addressBookBaseIdParameter.ToString())), new LocalizedString?(Strings.ErrorAddressListOrGlobalAddressListNotUnique(addressBookBaseIdParameter.ToString()))); if (configurable != null) { if (multiValuedProperty.Contains((ADObjectId)configurable.Identity)) { writeError(new InvalidOperationException(Strings.ErrorOabALAlreadyAssigned((target.Identity != null) ? target.Identity.ToString() : target.Name, configurable.Identity.ToString())), ErrorCategory.InvalidOperation, target.Identity); } else { multiValuedProperty.Add((ADObjectId)configurable.Identity); } } } } } return(multiValuedProperty); }
// Token: 0x06001254 RID: 4692 RVA: 0x00069B14 File Offset: 0x00067D14 private bool OABAddressListsAreValid(OfflineAddressBook oab) { bool flag = true; ADObjectId adobjectId = null; foreach (ADObjectId adobjectId2 in oab.AddressLists) { if (string.IsNullOrEmpty(adobjectId2.DistinguishedName)) { flag = false; adobjectId = adobjectId2; OABLogger.LogRecord(TraceType.ErrorTrace, "Address list id {0} is not valid because it does not have a DN", new object[] { adobjectId2 }); break; } if (!ADObjectId.IsValidDistinguishedName(adobjectId2.DistinguishedName)) { flag = false; adobjectId = adobjectId2; OABLogger.LogRecord(TraceType.ErrorTrace, "Address list id {0} is not valid because the DN is not validly formed", new object[] { adobjectId2.DistinguishedName }); break; } if (adobjectId2.IsDeleted) { flag = false; adobjectId = adobjectId2; OABLogger.LogRecord(TraceType.ErrorTrace, "Address list id {0} is not valid because it is a deleted object", new object[] { adobjectId2.DistinguishedName }); break; } bool flag2 = adobjectId2.DistinguishedName.IndexOf(",CN=LostAndFound,DC=", StringComparison.OrdinalIgnoreCase) != -1; bool flag3 = adobjectId2.DistinguishedName.IndexOf(",CN=LostAndFoundConfig,CN=Configuration,DC=", StringComparison.OrdinalIgnoreCase) != -1; if (flag2 || flag3) { flag = false; adobjectId = adobjectId2; OABLogger.LogRecord(TraceType.ErrorTrace, "Address list id {0} is not valid because it is a deleted object", new object[] { adobjectId2.DistinguishedName }); break; } bool flag4 = adobjectId2.DistinguishedName.IndexOf(GlobalAddressList.RdnGalContainerToOrganization.DistinguishedName, StringComparison.OrdinalIgnoreCase) > 0; bool flag5 = adobjectId2.DistinguishedName.IndexOf(AddressList.RdnAlContainerToOrganization.DistinguishedName, StringComparison.OrdinalIgnoreCase) > 0; if (!flag4 && !flag5) { flag = false; adobjectId = adobjectId2; OABLogger.LogRecord(TraceType.ErrorTrace, "Address list id {0} is not valid because it is not a child or descendant of either the All Global Address Lists or All Address Lists container", new object[] { adobjectId2.DistinguishedName }); break; } } if (!flag && adobjectId != null) { OABLogger.LogEvent(InfoWorkerEventLogConstants.Tuple_OABNotProcessedBecauseAddressListIsInvalid, new object[] { oab.Identity, string.IsNullOrEmpty(adobjectId.DistinguishedName) ? adobjectId.ToString() : adobjectId.DistinguishedName }); OABLogger.LogRecord(TraceType.ErrorTrace, "Address list errors found in OAB {0}, address list {1}", new object[] { oab.Id, string.IsNullOrEmpty(adobjectId.DistinguishedName) ? adobjectId.ToString() : adobjectId.DistinguishedName }); } return(flag); }
protected override void ResolveLocalSecondaryIdentities() { base.ResolveLocalSecondaryIdentities(); Mailbox mailbox = (Mailbox)this.GetDynamicParameters(); if (this.RemoveManagedFolderAndPolicy) { mailbox.ManagedFolderMailboxPolicy = null; } if (base.Fields.IsModified(MailboxSchema.RetentionPolicy)) { if (this.RetentionPolicy != null) { RetentionPolicy retentionPolicy = (RetentionPolicy)base.GetDataObject<RetentionPolicy>(this.RetentionPolicy, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorRetentionPolicyNotFound(this.RetentionPolicy.ToString())), new LocalizedString?(Strings.ErrorRetentionPolicyNotUnique(this.RetentionPolicy.ToString())), ExchangeErrorCategory.Client); mailbox.RetentionPolicy = (ADObjectId)retentionPolicy.Identity; mailbox.ManagedFolderMailboxPolicy = null; } else { mailbox.RetentionPolicy = null; } } base.SetReferenceParameter<RecipientIdParameter>(MailboxSchema.ForwardingAddress, this.ForwardingAddress, mailbox, new GetRecipientDelegate<RecipientIdParameter>(this.GetRecipient)); if (base.Fields.IsModified(MailboxSchema.OfflineAddressBook)) { if (this.OfflineAddressBook != null) { OfflineAddressBook offlineAddressBook = (OfflineAddressBook)base.GetDataObject<OfflineAddressBook>(this.OfflineAddressBook, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorOfflineAddressBookNotFound(this.OfflineAddressBook.ToString())), new LocalizedString?(Strings.ErrorOfflineAddressBookNotUnique(this.OfflineAddressBook.ToString())), ExchangeErrorCategory.Client); mailbox.OfflineAddressBook = (ADObjectId)offlineAddressBook.Identity; } else { mailbox.OfflineAddressBook = null; } } if (base.Fields.IsModified(ADRecipientSchema.AddressBookPolicy)) { AddressBookMailboxPolicyIdParameter addressBookMailboxPolicyIdParameter = (AddressBookMailboxPolicyIdParameter)base.Fields[ADRecipientSchema.AddressBookPolicy]; if (addressBookMailboxPolicyIdParameter != null) { AddressBookMailboxPolicy addressBookMailboxPolicy = (AddressBookMailboxPolicy)base.GetDataObject<AddressBookMailboxPolicy>(addressBookMailboxPolicyIdParameter, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorAddressBookMailboxPolicyNotFound(addressBookMailboxPolicyIdParameter.ToString())), new LocalizedString?(Strings.ErrorAddressBookMailboxPolicyNotUnique(addressBookMailboxPolicyIdParameter.ToString())), ExchangeErrorCategory.Client); mailbox[ADRecipientSchema.AddressBookPolicy] = (ADObjectId)addressBookMailboxPolicy.Identity; } else { mailbox[ADRecipientSchema.AddressBookPolicy] = null; } } if (base.Fields.IsModified(ADRecipientSchema.ThrottlingPolicy)) { if (SharedConfiguration.IsDehydratedConfiguration(base.CurrentOrganizationId)) { base.WriteError(new TaskInvalidOperationException(Strings.ErrorLinkOpOnDehydratedTenant("ThrottlingPolicy")), ExchangeErrorCategory.Context, this.DataObject.Identity); } ThrottlingPolicyIdParameter throttlingPolicyIdParameter = (ThrottlingPolicyIdParameter)base.Fields[ADRecipientSchema.ThrottlingPolicy]; if (throttlingPolicyIdParameter != null) { ThrottlingPolicy throttlingPolicy = (ThrottlingPolicy)base.GetDataObject<ThrottlingPolicy>(throttlingPolicyIdParameter, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorThrottlingPolicyNotFound(throttlingPolicyIdParameter.ToString())), new LocalizedString?(Strings.ErrorThrottlingPolicyNotUnique(throttlingPolicyIdParameter.ToString())), ExchangeErrorCategory.Client); mailbox[ADRecipientSchema.ThrottlingPolicy] = (ADObjectId)throttlingPolicy.Identity; } else { mailbox[ADRecipientSchema.ThrottlingPolicy] = null; } } if (base.Fields.IsModified(ADUserSchema.SharingPolicy)) { if (SharedConfiguration.IsDehydratedConfiguration(base.CurrentOrganizationId)) { base.WriteError(new LocalizedException(Strings.ErrorLinkOpOnDehydratedTenant("SharingPolicy")), ExchangeErrorCategory.Client, this.DataObject); } SharingPolicyIdParameter sharingPolicyIdParameter = (SharingPolicyIdParameter)base.Fields[ADUserSchema.SharingPolicy]; if (sharingPolicyIdParameter != null) { SharingPolicy sharingPolicy = (SharingPolicy)base.GetDataObject<SharingPolicy>(sharingPolicyIdParameter, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorSharingPolicyNotFound(sharingPolicyIdParameter.ToString())), new LocalizedString?(Strings.ErrorSharingPolicyNotUnique(sharingPolicyIdParameter.ToString())), ExchangeErrorCategory.Client); mailbox[ADUserSchema.SharingPolicy] = (ADObjectId)sharingPolicy.Identity; } else { mailbox[ADUserSchema.SharingPolicy] = null; } } if (base.Fields.IsModified(ADUserSchema.RemoteAccountPolicy)) { RemoteAccountPolicyIdParameter remoteAccountPolicyIdParameter = (RemoteAccountPolicyIdParameter)base.Fields[ADUserSchema.RemoteAccountPolicy]; if (remoteAccountPolicyIdParameter != null) { RemoteAccountPolicy remoteAccountPolicy = (RemoteAccountPolicy)base.GetDataObject<RemoteAccountPolicy>(remoteAccountPolicyIdParameter, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorRemoteAccountPolicyNotFound(remoteAccountPolicyIdParameter.ToString())), new LocalizedString?(Strings.ErrorRemoteAccountPolicyNotUnique(remoteAccountPolicyIdParameter.ToString())), ExchangeErrorCategory.Client); mailbox[ADUserSchema.RemoteAccountPolicy] = (ADObjectId)remoteAccountPolicy.Identity; } else { mailbox[ADUserSchema.RemoteAccountPolicy] = null; } } if (base.Fields.IsModified(ADRecipientSchema.RoleAssignmentPolicy)) { MailboxPolicyIdParameter mailboxPolicyIdParameter = (MailboxPolicyIdParameter)base.Fields[ADRecipientSchema.RoleAssignmentPolicy]; if (mailboxPolicyIdParameter != null) { IConfigurationSession tenantLocalConfigSession = RecipientTaskHelper.GetTenantLocalConfigSession(base.CurrentOrganizationId, base.ExecutingUserOrganizationId, base.RootOrgContainerId); RoleAssignmentPolicy roleAssignmentPolicy = (RoleAssignmentPolicy)base.GetDataObject<RoleAssignmentPolicy>(mailboxPolicyIdParameter, tenantLocalConfigSession, null, new LocalizedString?(Strings.ErrorRoleAssignmentPolicyNotFound(mailboxPolicyIdParameter.ToString())), new LocalizedString?(Strings.ErrorRoleAssignmentPolicyNotUnique(mailboxPolicyIdParameter.ToString())), ExchangeErrorCategory.Client); mailbox[ADRecipientSchema.RoleAssignmentPolicy] = (ADObjectId)roleAssignmentPolicy.Identity; } else { mailbox[ADRecipientSchema.RoleAssignmentPolicy] = null; } } if (base.Fields.IsModified(ADRecipientSchema.MailboxPlan)) { if (this.MailboxPlan != null) { ADUser aduser = base.ProvisioningCache.TryAddAndGetOrganizationDictionaryValue<ADUser, string>(CannedProvisioningCacheKeys.CacheKeyMailboxPlanIdParameterId, base.CurrentOrganizationId, this.MailboxPlan.RawIdentity, () => (ADUser)base.GetDataObject<ADUser>(this.MailboxPlan, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorMailboxPlanNotFound(this.MailboxPlan.ToString())), new LocalizedString?(Strings.ErrorMailboxPlanNotUnique(this.MailboxPlan.ToString())), ExchangeErrorCategory.Client)); MailboxTaskHelper.ValidateMailboxPlanRelease(aduser, new Task.ErrorLoggerDelegate(base.WriteError)); mailbox[ADRecipientSchema.MailboxPlan] = (ADObjectId)aduser.Identity; return; } mailbox[ADRecipientSchema.MailboxPlan] = null; } }
internal static ADObjectId ValidateGeneratingMailbox(IConfigDataProvider session, MailboxIdParameter generatingMailboxId, OfflineAddressBookTaskUtility.GetUniqueObject getAdUser, OfflineAddressBook target, Task.TaskWarningLoggingDelegate writeWarning, Task.TaskErrorLoggingDelegate writeError) { ADObjectId result = null; if (OABVariantConfigurationSettings.IsLinkedOABGenMailboxesEnabled) { if (generatingMailboxId == null) { writeWarning(Strings.WarningGeneratingMailboxIsNullOABWillNotBeGenerated); } else { ADUser aduser = (ADUser)getAdUser(generatingMailboxId, session, null, new LocalizedString?(Strings.ErrorMailboxAddressNotFound(generatingMailboxId.ToString())), new LocalizedString?(Strings.ErrorMailboxAddressNotUnique(generatingMailboxId.ToString()))); if (aduser.RecipientTypeDetails != RecipientTypeDetails.ArbitrationMailbox || aduser.PersistedCapabilities == null || !aduser.PersistedCapabilities.Contains(Capability.OrganizationCapabilityOABGen)) { writeError(new InvalidOperationException(Strings.ErrorGeneratingMailboxInvalid(aduser.Name)), ErrorCategory.InvalidOperation, target.Identity); } result = aduser.Id; } } else if (generatingMailboxId != null) { writeError(new InvalidOperationException(Strings.ErrorLinkedMailboxesAreNotSupported), ErrorCategory.InvalidOperation, target.Identity); } return(result); }