protected override void StampChangesOn(IConfigurable dataObject) { AddressBookBase addressBookBase = (AddressBookBase)dataObject; this.originalVersion = addressBookBase.ExchangeVersion; base.StampChangesOn(dataObject); if (base.Fields.IsModified(AddressBookBaseSchema.RecipientFilter)) { addressBookBase.SetRecipientFilter(this.innerFilter); } }
private void CreateCannedAddressList(string name, QueryFilter recipientFilter) { bool flag = string.Equals(name, CannedAddressListsFilterHelper.DefaultAllModernGroups, StringComparison.InvariantCulture); if (flag && (!this.CreateModernGroupsAddressList.IsPresent || !VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).CmdletInfra.InstallModernGroupsAddressList.Enabled)) { return; } ADObjectId id = this.DataObject.Id; AddressBookBase[] array = this.FindAddressList(name, recipientFilter); if (array == null || array.Length == 0) { AddressBookBase addressBookBase = new AddressBookBase(); string text = name; if (flag) { text = Strings.DefaultAllGroups; addressBookBase.IsModernGroupsAddressList = true; } ADObjectId childId = id.GetChildId(text); addressBookBase.SetId(childId); addressBookBase.DisplayName = text; addressBookBase.SetRecipientFilter(recipientFilter); RecipientFilterHelper.StampE2003FilterMetadata(addressBookBase, addressBookBase.LdapRecipientFilter, AddressBookBaseSchema.PurportedSearchUI); addressBookBase.OrganizationId = (base.CurrentOrganizationId ?? OrganizationId.ForestWideOrgId); base.WriteVerbose(TaskVerboseStringHelper.GetSaveObjectVerboseString(addressBookBase, base.DataSession, typeof(AddressBookBase))); try { base.DataSession.Save(addressBookBase); if (string.Equals(name, CannedAddressListsFilterHelper.DefaultAllRooms, StringComparison.InvariantCulture)) { this.PostOrganization(childId); } } catch (ADObjectAlreadyExistsException) { base.WriteVerbose(Strings.VerboseCannedAddressListAlreadyExists(name)); } finally { base.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(base.DataSession)); } base.WriteObject(addressBookBase); } }
private void CreateDefaultGal(ADObjectId defaultGal) { AddressBookBase addressBookBase = new AddressBookBase(); addressBookBase.SetId(defaultGal); addressBookBase.DisplayName = defaultGal.Name; addressBookBase.SetRecipientFilter(GlobalAddressList.RecipientFilterForDefaultGal); addressBookBase[AddressBookBaseSchema.RecipientFilterFlags] = (RecipientFilterableObjectFlags.FilterApplied | RecipientFilterableObjectFlags.IsDefault); RecipientFilterHelper.StampE2003FilterMetadata(addressBookBase, addressBookBase.LdapRecipientFilter, AddressBookBaseSchema.PurportedSearchUI); addressBookBase.OrganizationId = (base.CurrentOrganizationId ?? OrganizationId.ForestWideOrgId); base.WriteVerbose(TaskVerboseStringHelper.GetSaveObjectVerboseString(addressBookBase, base.DataSession, typeof(AddressBookBase))); try { base.DataSession.Save(addressBookBase); } finally { base.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(base.DataSession)); } base.WriteObject(addressBookBase); }
private void UpdateTheAllUsersAddressList() { AddressBookBase[] array = this.FindAddressList(CannedAddressListsFilterHelper.DefaultAllUsers, CannedAddressListsFilterHelper.DefaultAllUsersFilter); if (array == null || array.Length == 0) { return; } AddressBookBase addressBookBase = array[0]; if (!object.Equals(addressBookBase.RecipientFilter, CannedAddressListsFilterHelper.DefaultAllUsersFilter)) { addressBookBase.SetRecipientFilter(CannedAddressListsFilterHelper.DefaultAllUsersFilter); try { base.DataSession.Save(addressBookBase); } finally { base.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(base.DataSession)); } } }