private PropertyValidationError ValidateSingleValue(ExchangeOperationContext context, object value, Type expectedType) { if (value == null) { return(new NullValueError(this, value)); } if (value is DateTime && expectedType.Equals(typeof(ExDateTime))) { expectedType = typeof(DateTime); } Type type = value.GetType(); if (!expectedType.Equals(type) && !expectedType.GetTypeInfo().IsAssignableFrom(type.GetTypeInfo())) { return(new TypeMismatchError(this, value)); } for (int i = 0; i < this.constraints.Count; i++) { PropertyValidationError propertyValidationError = this.constraints[i].Validate(context, value, this, null); if (propertyValidationError != null) { return(propertyValidationError); } } return(null); }
/// <summary> /// Initializes a new instance of the <see cref="PropertyError"/> class. /// </summary> /// <param name="error">The error.</param> /// <param name="propertyName">Name of the property.</param> /// <param name="errorMessage">The message</param> /// <param name="errorMessageResourceKey">The message resource key</param> public PropertyError(PropertyValidationError error, string propertyName, string errorMessage, string errorMessageResourceKey) { _PropertyName = propertyName; _PropertyValidationError = error; _ErrorMessage = errorMessage; _ErrorMessageResourceKey = errorMessageResourceKey; }
internal static object QuotaSettingGetter(ADPropertyDefinition adPropertyDefinition, IPropertyBag propertyBag) { if (adPropertyDefinition == null) { throw new ArgumentNullException("adPropertyDefinition"); } MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[DataClassificationConfigSchema.DataClassificationConfigQuotaSettings]; string quotaSettingIdentifier = adPropertyDefinition.Name + ':'; object result = adPropertyDefinition.DefaultValue; if (multiValuedProperty != null && multiValuedProperty.Count > 0) { string text = multiValuedProperty.FirstOrDefault((string item) => item.StartsWith(quotaSettingIdentifier, StringComparison.Ordinal)); if (!string.IsNullOrEmpty(text)) { try { result = ValueConvertor.ConvertValueFromString(text.Substring(quotaSettingIdentifier.Length), adPropertyDefinition.Type, null); } catch (FormatException ex) { PropertyValidationError error = new PropertyValidationError(DirectoryStrings.CannotCalculateProperty(adPropertyDefinition.Name, ex.Message), adPropertyDefinition, propertyBag[DataClassificationConfigSchema.DataClassificationConfigQuotaSettings]); throw new DataValidationException(error, ex); } } } return(result); }
protected override void InternalValidate() { try { base.InternalValidate(); } catch (NotSupportedException exception) { base.WriteError(exception, ErrorCategory.InvalidType, this.DataObject.Identity); } if (this.DataObject.FolderPath.IsSubtreeRoot) { base.WriteError(new ModificationDisallowedException(Strings.ExceptionModifyIpmSubtree), ErrorCategory.InvalidOperation, this.DataObject.Identity); } if (this.DataObject.IsChanged(PublicFolderSchema.Name)) { PropertyValidationError propertyValidationError = PublicFolderSchema.Name.ValidateValue(this.DataObject.Name, false); if (propertyValidationError != null) { base.WriteError(new DataValidationException(propertyValidationError), ErrorCategory.InvalidArgument, this.DataObject.Identity); } } ValidationError[] array = Database.ValidateAscendingQuotas(this.DataObject.propertyBag, new ProviderPropertyDefinition[] { PublicFolderSchema.IssueWarningQuota, PublicFolderSchema.ProhibitPostQuota }, this.DataObject.Identity); if (array.Length > 0) { base.WriteError(new DataValidationException(array[0]), ErrorCategory.InvalidArgument, this.DataObject.Identity); } this.ValidateAndUpdateMailPublicFolderParameters(); }
// Token: 0x06000E78 RID: 3704 RVA: 0x00045564 File Offset: 0x00043764 private static ADRawEntry ADRawEntryFromPropValues(ADObjectId id, bool createReadOnly, PropValue[] propValues, IEnumerable <MbxPropertyDefinition> properties, List <ValidationError> errors) { string fqdn = LocalServerCache.LocalServer.Fqdn; ADPropertyBag adpropertyBag = new ADPropertyBag(createReadOnly, 16); adpropertyBag.SetField(ADObjectSchema.Id, id); foreach (PropValue propValue in propValues) { if (!propValue.IsError()) { MbxPropertyDefinition mbxPropertyDefinition = ObjectSchema.GetInstance <MbxRecipientSchema>().FindPropertyDefinitionByPropTag(propValue.PropTag); PropertyValidationError propertyValidationError = mbxPropertyDefinition.ValidateValue(propValue.Value, true); if (propertyValidationError != null) { errors.Add(propertyValidationError); } adpropertyBag.SetField(mbxPropertyDefinition, SimpleStoreValueConverter.ConvertValueFromStore(mbxPropertyDefinition, propValue.Value)); } } MbxRecipientSession.PopulateCustomizedCalculatedProperties(adpropertyBag, properties); ADRawEntry adrawEntry = new ADRawEntry(adpropertyBag); adrawEntry.OriginatingServer = fqdn; adrawEntry.WhenReadUTC = new DateTime?(DateTime.UtcNow); adrawEntry.ResetChangeTracking(true); return(adrawEntry); }
public static void ValidateItemLimits(Unlimited <int> badItemLimit, Unlimited <int> largeItemLimit, SwitchParameter acceptLargeDataLoss, Task.TaskErrorLoggingDelegate writeError, Task.TaskWarningLoggingDelegate writeWarning, string executingUserIdentity) { Unlimited <int> value = new Unlimited <int>(TestIntegration.Instance.LargeDataLossThreshold); PropertyValidationError propertyValidationError = RequestJobSchema.BadItemLimit.ValidateValue(badItemLimit, false); if (propertyValidationError != null) { writeError(new DataValidationException(propertyValidationError), ErrorCategory.InvalidArgument, badItemLimit); } propertyValidationError = RequestJobSchema.LargeItemLimit.ValidateValue(largeItemLimit, false); if (propertyValidationError != null) { writeError(new DataValidationException(propertyValidationError), ErrorCategory.InvalidArgument, largeItemLimit); } if (largeItemLimit > value && !acceptLargeDataLoss) { writeError(new LargeDataLossNotAcceptedPermanentException("LargeItemLimit", largeItemLimit.ToString(), "AcceptLargeDataLoss", executingUserIdentity), ErrorCategory.InvalidArgument, acceptLargeDataLoss); } if (badItemLimit == RequestTaskHelper.UnlimitedZero && largeItemLimit == RequestTaskHelper.UnlimitedZero && acceptLargeDataLoss) { writeError(new RecipientTaskException(Strings.ErrorParameterValueNotAllowed("AcceptLargeDataLoss")), ErrorCategory.InvalidArgument, acceptLargeDataLoss); } if (badItemLimit > RequestTaskHelper.UnlimitedZero) { writeWarning(Strings.WarningNonZeroItemLimitMove("BadItemLimit")); } if (largeItemLimit > RequestTaskHelper.UnlimitedZero) { writeWarning(Strings.WarningNonZeroItemLimitMove("LargeItemLimit")); } }
private void RemoveADRecipientSupervisionListEntry(bool isGroup, ADRecipient adRecipientToRemove) { MultiValuedProperty <ADObjectIdWithString> supervisionListForADRecipient = base.GetSupervisionListForADRecipient(isGroup); ADObjectIdWithString adobjectIdWithString = null; string[] array = null; PropertyValidationError propertyValidationError = base.FindADRecipientEntry(adRecipientToRemove, supervisionListForADRecipient, out adobjectIdWithString, out array); if (propertyValidationError != null) { return; } if (adobjectIdWithString != null) { foreach (string text in array) { if (text.Equals(this.Tag, StringComparison.OrdinalIgnoreCase)) { this.RemoveTagFromADRecipientEntry(adobjectIdWithString, array, supervisionListForADRecipient); return; } } base.WriteError(new RecipientTaskException(Strings.ErrorSupervisionEntryNotPresent(this.Entry.ToString(), this.Tag.ToLower())), (ErrorCategory)1003, null); return; } base.WriteError(new RecipientTaskException(Strings.ErrorSupervisionEntryNotPresent(this.Entry.ToString(), this.Tag.ToLower())), (ErrorCategory)1003, null); }
private void SetTrustedList(MailboxJunkEmailConfiguration o, JunkEmailRule rule) { MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationTuple junkEmailValidationTuple = this.SetList(o.TrustedSendersAndDomains, rule.TrustedSenderEmailCollection, rule.TrustedSenderDomainCollection); if (junkEmailValidationTuple.Problem == MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsGood) { junkEmailValidationTuple = this.SetList(o.TrustedSendersAndDomains, rule.TrustedRecipientEmailCollection, rule.TrustedRecipientDomainCollection); } LocalizedString localizedString = LocalizedString.Empty; switch (junkEmailValidationTuple.Problem) { case MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsUsersEmailOrDomain: localizedString = ServerStrings.JunkEmailTrustedListOwnersEmailAddressException(junkEmailValidationTuple.Address); goto IL_EB; case MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsInternalToOrganization: localizedString = ServerStrings.JunkEmailTrustedListInternalToOrganizationException(junkEmailValidationTuple.Address); goto IL_EB; case MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsDuplicate: localizedString = ServerStrings.JunkEmailTrustedListXsoDuplicateException(junkEmailValidationTuple.Address); goto IL_EB; case MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsEmpty: localizedString = ServerStrings.JunkEmailTrustedListXsoEmptyException; goto IL_EB; case MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsMalformatted: localizedString = ServerStrings.JunkEmailTrustedListXsoFormatException(junkEmailValidationTuple.Address); goto IL_EB; case MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsNull: localizedString = ServerStrings.JunkEmailTrustedListXsoNullException; goto IL_EB; case MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsTooBig: localizedString = ServerStrings.JunkEmailTrustedListXsoTooBigException(junkEmailValidationTuple.Address); goto IL_EB; case MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsFull: localizedString = ServerStrings.JunkEmailTrustedListXsoTooManyException; goto IL_EB; case MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsGood: goto IL_EB; } localizedString = ServerStrings.JunkEmailTrustedListXsoGenericException(junkEmailValidationTuple.Address); IL_EB: if (localizedString != LocalizedString.Empty) { PropertyValidationError propertyValidationError = new PropertyValidationError(localizedString, MailboxJunkEmailConfigurationSchema.TrustedSendersAndDomains, o.TrustedSendersAndDomains); throw new PropertyValidationException(localizedString.ToString(), propertyValidationError.PropertyDefinition, new PropertyValidationError[] { propertyValidationError }); } }
private void ValidateDeletePropertyValue() { if ((this.PropertyFlags & PropertyFlags.ReadOnly) != PropertyFlags.None) { PropertyValidationError propertyValidationError = new PropertyValidationError(new LocalizedString(ServerStrings.PropertyIsReadOnly(base.Name)), this, null); throw new PropertyValidationException(ServerStrings.PropertyIsReadOnly(base.Name), this, new PropertyValidationError[] { propertyValidationError }); } }
internal ExchangePrincipal CreateExchangePrincipal() { ExchangePrincipal result = null; try { OwaDiagnostics.TracePfd(18057, "Creating new ExchangePrincipal", new object[0]); if (ExTraceGlobals.CoreTracer.IsTraceEnabled(TraceType.DebugTrace)) { string text = null; using (WindowsIdentity current = WindowsIdentity.GetCurrent()) { text = current.Name; } if (string.IsNullOrEmpty(text)) { text = "<n/a>"; } string arg = this.SafeGetRenderableName(); ExTraceGlobals.CoreTracer.TraceDebug <string, string>(0L, "Using accout {0} to bind to ExchangePrincipal object for user {1}", text, arg); } result = this.InternalCreateExchangePrincipal(); } catch (ObjectNotFoundException ex) { bool flag = false; DataValidationException ex2 = ex.InnerException as DataValidationException; if (ex2 != null) { PropertyValidationError propertyValidationError = ex2.Error as PropertyValidationError; if (propertyValidationError != null && propertyValidationError.PropertyDefinition == MiniRecipientSchema.Languages) { OWAMiniRecipient owaminiRecipient = this.FixCorruptOWAMiniRecipientCultureEntry(); if (owaminiRecipient != null) { try { result = ExchangePrincipal.FromMiniRecipient(owaminiRecipient, RemotingOptions.AllowCrossSite); flag = true; } catch (ObjectNotFoundException) { } } } } if (!flag) { throw ex; } } return(result); }
private void ValidateSetPropertyValue(ExchangeOperationContext context, object value) { if (value == null) { throw new ArgumentNullException(base.Name); } PropertyValidationError[] array = this.Validate(context, value); if (array.Length > 0) { PropertyValidationError propertyValidationError = array[0]; throw new PropertyValidationException(propertyValidationError.Description, propertyValidationError.PropertyDefinition, array); } }
protected override void InternalValidate() { base.InternalValidate(); if (base.HasErrors) { return; } ADOwaVirtualDirectory dataObject = this.DataObject; if (dataObject.ExchangeVersion.IsOlderThan(ADOwaVirtualDirectory.MinimumSupportedExchangeObjectVersion)) { base.WriteError(new TaskException(Strings.ErrorSetOlderVirtualDirectory(dataObject.Identity.ToString(), dataObject.ExchangeVersion.ToString(), ADOwaVirtualDirectory.MinimumSupportedExchangeObjectVersion.ToString())), ErrorCategory.InvalidArgument, null); } if (dataObject.WebReadyFileTypes != null) { foreach (string text in dataObject.WebReadyFileTypes) { if (!dataObject.WebReadyDocumentViewingSupportedFileTypes.Contains(text.ToLower())) { PropertyValidationError error = new PropertyValidationError(DataStrings.ConstraintViolationValueIsNotInGivenStringArray(string.Join(",", dataObject.WebReadyDocumentViewingSupportedFileTypes.ToArray()), text), ADOwaVirtualDirectorySchema.WebReadyFileTypes, dataObject.WebReadyFileTypes); DataValidationException exception = new DataValidationException(error); base.WriteError(exception, ErrorCategory.InvalidArgument, this.DataObject.Identity); } } } if (dataObject.WebReadyMimeTypes != null) { foreach (string text2 in dataObject.WebReadyMimeTypes) { if (!dataObject.WebReadyDocumentViewingSupportedMimeTypes.Contains(text2.ToLower())) { PropertyValidationError error2 = new PropertyValidationError(DataStrings.ConstraintViolationValueIsNotInGivenStringArray(string.Join(",", dataObject.WebReadyDocumentViewingSupportedMimeTypes.ToArray()), text2), ADOwaVirtualDirectorySchema.WebReadyMimeTypes, dataObject.WebReadyMimeTypes); DataValidationException exception2 = new DataValidationException(error2); base.WriteError(exception2, ErrorCategory.InvalidArgument, this.DataObject.Identity); } } } if (dataObject.InstantMessagingType == InstantMessagingTypeOptions.Msn && !Datacenter.IsMultiTenancyEnabled()) { base.WriteError(new TaskException(Strings.ErrorMsnIsNotSupportedInEnterprise), ErrorCategory.InvalidArgument, null); } if (base.Fields.Contains("AdfsAuthentication") && this.DataObject.AdfsAuthentication) { ADEcpVirtualDirectory adecpVirtualDirectory = WebAppVirtualDirectoryHelper.FindWebAppVirtualDirectoryInSameWebSite <ADEcpVirtualDirectory>(this.DataObject, base.DataSession); if (adecpVirtualDirectory == null || !adecpVirtualDirectory.AdfsAuthentication) { base.WriteError(new TaskException(Strings.CannotConfigureAdfsOwaWithoutEcpFirst), ErrorCategory.InvalidOperation, null); } } }
private List <ValidationError> FilterErrorsFromCurrentPage(ValidationError[] errors) { List <ValidationError> list = new List <ValidationError>(errors.Length); foreach (ValidationError validationError in errors) { PropertyValidationError propertyError = validationError as PropertyValidationError; if (this.BlockPageSwitchWithError(propertyError)) { list.Add(validationError); } } return(list); }
protected LocalizedString CreateValidateContextErrorMessageFor(List <ValidationError> errors) { object[] array = new object[errors.Count]; for (int i = 0; i < errors.Count; i++) { ValidationError validationError = errors[i]; array[i] = validationError.Description; PropertyValidationError propertyValidationError = validationError as PropertyValidationError; if (propertyValidationError != null && propertyValidationError.PropertyDefinition != null) { this.InputValidationProvider.UpdateErrorProviderTextForProperty(propertyValidationError.Description, propertyValidationError.PropertyDefinition.Name); } } return(LocalizedString.Join(Environment.NewLine, array)); }
// Token: 0x06001978 RID: 6520 RVA: 0x0006BF38 File Offset: 0x0006A138 private void DDLExpansionHandler(DirectoryException de) { PropertyValidationError propertyValidationError = this.CheckForDDLMisconfiguration(de); if (propertyValidationError != null) { ADProviderPerf.UpdateProcessCounter(Counter.ProcessRateCriticalValidationFailures, UpdateType.Update, 1U); Globals.LogEvent(DirectoryEventLogConstants.Tuple_DynamicDistributionGroupFilterError, base.Id.ToString(), new object[] { base.Id.ToDNString(), base.OriginatingServer, propertyValidationError.Description }); throw new DataValidationException(propertyValidationError, de); } }
private ValidationError ConvertMappingProperty(ValidationError error, object dataObject, DataTable table) { ValidationError result = error; PropertyValidationError propertyValidationError = error as PropertyValidationError; if (propertyValidationError != null) { string columnNameThruMappingProperty = this.GetColumnNameThruMappingProperty(propertyValidationError.PropertyDefinition.Name, table, dataObject); if (!string.IsNullOrEmpty(columnNameThruMappingProperty)) { PropertyDefinition propertyDefinition = new AdminPropertyDefinition(columnNameThruMappingProperty, ExchangeObjectVersion.Exchange2003, typeof(bool), true, PropertyDefinitionConstraint.None, PropertyDefinitionConstraint.None); result = new PropertyValidationError(propertyValidationError.Description, propertyDefinition, propertyValidationError.InvalidData); } } return(result); }
public PropertyValidationError[] Validate(ExchangeOperationContext context, object value) { if ((this.PropertyFlags & PropertyFlags.Multivalued) == PropertyFlags.Multivalued) { return(this.ValidateMultiValue(context, value)); } PropertyValidationError propertyValidationError = this.ValidateSingleValue(context, value, base.Type); if (propertyValidationError != null) { return(new PropertyValidationError[] { propertyValidationError }); } return(StorePropertyDefinition.NoValidationError); }
private T ObjectFromItem <T>(Item item) where T : IConfigurable, new() { EwsStoreObject ewsStoreObject = (EwsStoreObject)((object)((default(T) == null) ? Activator.CreateInstance <T>() : default(T))); object originalValue = null; ExchangeObjectVersion exchangeVersion = (ExchangeObjectVersion)EwsStoreObjectSchema.ExchangeVersion.DefaultValue; if (item.TryGetProperty(EwsStoreObjectSchema.ExchangeVersion.StorePropertyDefinition, ref originalValue)) { exchangeVersion = (ExchangeObjectVersion)ValueConvertor.ConvertValue(originalValue, typeof(ExchangeObjectVersion), null); ewsStoreObject.SetExchangeVersion(exchangeVersion); if (ewsStoreObject.ExchangeVersion.Major > ewsStoreObject.MaximumSupportedExchangeObjectVersion.Major) { ExTraceGlobals.StorageTracer.TraceWarning <ItemId, byte, byte>(0L, "{0} has major version {1} which is greater than current one ({2}) and will be ignored", item.Id, ewsStoreObject.ExchangeVersion.Major, ewsStoreObject.MaximumSupportedExchangeObjectVersion.Major); return(default(T)); } } if (!string.IsNullOrEmpty(ewsStoreObject.ItemClass) && !ewsStoreObject.ItemClass.Equals(item.ItemClass, StringComparison.OrdinalIgnoreCase)) { return(default(T)); } ewsStoreObject.CopyFromItemObject(item, this.RequestedServerVersion); if (ewsStoreObject.MaximumSupportedExchangeObjectVersion.IsOlderThan(ewsStoreObject.ExchangeVersion)) { ExTraceGlobals.StorageTracer.TraceWarning <ItemId, ExchangeObjectVersion, ExchangeObjectVersion>(0L, "{0} has version {1} which is greater than current one ({2}) and will be read-only", item.Id, ewsStoreObject.ExchangeVersion, ewsStoreObject.MaximumSupportedExchangeObjectVersion); ewsStoreObject.SetIsReadOnly(true); } ValidationError[] array = ewsStoreObject.ValidateRead(); ewsStoreObject.ResetChangeTracking(true); if (array.Length > 0) { foreach (ValidationError validationError in array) { PropertyValidationError propertyValidationError = validationError as PropertyValidationError; ExTraceGlobals.StorageTracer.TraceDebug((long)this.GetHashCode(), "Object '{0}' read from '{1}' failed validation. Attribute: '{2}'. Invalid data: '{3}'. Error message: '{4}'.", new object[] { ewsStoreObject.Identity, this.Mailbox.ToString() + "\\" + this.DefaultFolder.ToString(), (propertyValidationError != null) ? propertyValidationError.PropertyDefinition.Name : "<null>", (propertyValidationError != null) ? (propertyValidationError.InvalidData ?? "<null>") : "<null>", validationError.Description }); } } return((T)((object)this.FilterObject(ewsStoreObject))); }
protected virtual void DoLoad(OwaIdentity logonIdentity, OwaIdentity mailboxIdentity, UserContextStatistics stats) { if (logonIdentity == null) { throw new ArgumentNullException("logonIdentity"); } this.logonIdentity = logonIdentity; if (mailboxIdentity != null) { this.isExplicitLogon = true; this.mailboxIdentity = mailboxIdentity; } else { this.mailboxIdentity = logonIdentity; } if (this.IsExplicitLogon) { ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "Created partial mailbox identity from SMTP address={0}", mailboxIdentity.SafeGetRenderableName()); OwaMiniRecipientIdentity owaMiniRecipientIdentity = this.mailboxIdentity as OwaMiniRecipientIdentity; try { owaMiniRecipientIdentity.UpgradePartialIdentity(); } catch (DataValidationException ex) { PropertyValidationError propertyValidationError = ex.Error as PropertyValidationError; if (propertyValidationError == null || propertyValidationError.PropertyDefinition != MiniRecipientSchema.Languages) { throw; } OWAMiniRecipient owaminiRecipient = this.MailboxIdentity.FixCorruptOWAMiniRecipientCultureEntry(); if (owaminiRecipient != null) { this.mailboxIdentity = OwaMiniRecipientIdentity.CreateFromOWAMiniRecipient(owaminiRecipient); } } } Stopwatch stopwatch = Stopwatch.StartNew(); this.exchangePrincipal = this.mailboxIdentity.CreateExchangePrincipal(); stats.ExchangePrincipalCreationTime = (int)stopwatch.ElapsedMilliseconds; this.LogTrace("UserContextBase.Load", "CreateExchangePrincipal finished"); this.pendingRequestManager = new PendingRequestManager(this, ListenerChannelsManager.Instance); }
internal ValidationError AddManagedFolderToPolicy(IConfigurationSession session, ELCFolder elcFolderToAdd) { ValidationError result; if (elcFolderToAdd.FolderType != ElcFolderType.ManagedCustomFolder) { ADObjectId adobjectId = this.ManagedFolderLinks.Find(delegate(ADObjectId id) { ELCFolder elcfolder = session.Read <ELCFolder>(id); return(elcfolder != null && elcfolder.FolderType == elcFolderToAdd.FolderType); }); if (adobjectId == null) { try { this.ManagedFolderLinks.Add(elcFolderToAdd.Id); return(null); } catch (InvalidOperationException ex) { return(new PropertyValidationError(DirectoryStrings.ErrorInvalidFolderLinksAddition(elcFolderToAdd.Name, ex.Message), ManagedFolderMailboxPolicySchema.ManagedFolderLinks, this)); } } if (adobjectId == elcFolderToAdd.Id) { return(new PropertyValidationError(DirectoryStrings.ErrorDuplicateManagedFolderAddition(elcFolderToAdd.Name), ManagedFolderMailboxPolicySchema.ManagedFolderLinks, this)); } return(new PropertyValidationError(DirectoryStrings.ErrorDefaultElcFolderTypeExists(elcFolderToAdd.Name, elcFolderToAdd.FolderType.ToString()), ManagedFolderMailboxPolicySchema.ManagedFolderLinks, this)); } else { try { this.ManagedFolderLinks.Add(elcFolderToAdd.Id); result = null; } catch (InvalidOperationException ex2) { result = new PropertyValidationError(new LocalizedString(ex2.Message), ManagedFolderMailboxPolicySchema.ManagedFolderLinks, this); } } return(result); }
private PropertyValidationError[] ValidateMultiValue(ExchangeOperationContext context, object value) { if (value == null) { return(new PropertyValidationError[] { new NullValueError(this, value) }); } IEnumerable enumerable = value as IEnumerable; if (enumerable == null) { return(new PropertyValidationError[] { new TypeMismatchError(this, value) }); } if (!value.GetType().Equals(base.Type)) { return(new PropertyValidationError[] { new TypeMismatchError(this, value) }); } int num = 0; List <PropertyValidationError> list = new List <PropertyValidationError>(); Type elementType = base.Type.GetElementType(); int num2 = 0; foreach (object value2 in enumerable) { num++; PropertyValidationError propertyValidationError = this.ValidateSingleValue(context, value2, elementType); if (propertyValidationError != null) { PropertyValidationError item = new InvalidMultivalueElementError(propertyValidationError, value, num2); list.Add(item); } num2++; } return(list.ToArray()); }
private void AddExternalRecipientSupervisionListEntry(SmtpAddress externalRecipientToAdd, ADObjectId configContainerId) { if (configContainerId == null) { base.WriteError(new ArgumentNullException("configContainerId"), (ErrorCategory)1000, null); } MultiValuedProperty <ADObjectIdWithString> supervisionListForExternalAddress = base.GetSupervisionListForExternalAddress(); ADObjectIdWithString adobjectIdWithString = null; string[] array = null; PropertyValidationError propertyValidationError = base.FindExternalAddressEntry(externalRecipientToAdd, supervisionListForExternalAddress, out adobjectIdWithString, out array); if (propertyValidationError != null) { return; } if (adobjectIdWithString != null) { foreach (string text in array) { if (text.Equals(this.Tag, StringComparison.OrdinalIgnoreCase)) { base.WriteError(new RecipientTaskException(Strings.ErrorSupervisionEntryAlreadyPresent(this.Entry.ToString(), this.Tag.ToLower())), (ErrorCategory)1003, null); } } string stringValue = this.Tag.ToLower() + "," + adobjectIdWithString.StringValue; ADObjectIdWithString item = new ADObjectIdWithString(stringValue, adobjectIdWithString.ObjectIdValue); supervisionListForExternalAddress.Remove(adobjectIdWithString); supervisionListForExternalAddress.Add(item); } else { string stringValue2 = this.Tag.ToLower() + "," + externalRecipientToAdd.ToString(); ADObjectIdWithString item2 = new ADObjectIdWithString(stringValue2, configContainerId); supervisionListForExternalAddress.Add(item2); } if (base.IsVerboseOn) { base.WriteVerbose(Strings.SupervisionListEntryAdded(this.Entry.ToString(), Strings.ExternalAddress, this.Tag)); } }
public static bool IsPropertyValid(ADObject o, PropertyDefinition property, out ValidationError validationError) { bool result = true; validationError = null; ValidationError[] array = o.ValidateRead(); foreach (ValidationError validationError2 in array) { if (validationError2 is PropertyValidationError) { PropertyValidationError propertyValidationError = validationError2 as PropertyValidationError; if (string.Compare(property.Name, propertyValidationError.PropertyDefinition.Name, true, CultureInfo.InvariantCulture) == 0 && property.Type == propertyValidationError.PropertyDefinition.Type) { result = false; validationError = validationError2; break; } } } return(result); }
private string CreateErrorMessageForCorruptedObject() { ADObject adobject = base.Context.DataHandler.DataSource as ADObject; string str; if (adobject != null && !string.IsNullOrEmpty(adobject.Name)) { str = Strings.CorruptedObjectErrorMessageObjectName(string.Format("'{0}'", adobject.Name)); } else { str = Strings.CorruptedObjectErrorMessageNoName; } LocalizedString localizedString = LocalizedString.Empty; IConfigurable configurable = base.Context.DataHandler.DataSource as IConfigurable; if (configurable != null) { ValidationError[] array = configurable.Validate(); List <string> list = new List <string>(array.Length); foreach (ValidationError validationError in array) { PropertyValidationError propertyValidationError = validationError as PropertyValidationError; if (propertyValidationError != null) { string name = propertyValidationError.PropertyDefinition.Name; if (!list.Contains(name)) { list.Add(name); } } } if (list.Count > 0) { localizedString = Strings.CorruptedObjectErrorPropertyNames(string.Join(", ", list.ToArray())); } } return(str + Strings.CorruptedObjectErrorMessageBody.ToString() + localizedString.ToString()); }
private void AddADRecipientSupervisionListEntry(bool isGroup, ADRecipient adRecipientToAdd) { MultiValuedProperty <ADObjectIdWithString> supervisionListForADRecipient = base.GetSupervisionListForADRecipient(isGroup); ADObjectIdWithString adobjectIdWithString = null; string[] array = null; PropertyValidationError propertyValidationError = base.FindADRecipientEntry(adRecipientToAdd, supervisionListForADRecipient, out adobjectIdWithString, out array); if (propertyValidationError != null) { return; } if (adobjectIdWithString != null) { foreach (string text in array) { if (text.Equals(this.Tag, StringComparison.OrdinalIgnoreCase)) { base.WriteError(new RecipientTaskException(Strings.ErrorSupervisionEntryAlreadyPresent(this.Entry.ToString(), this.Tag.ToLower())), (ErrorCategory)1003, null); } } string stringValue = this.Tag.ToLower() + "," + adobjectIdWithString.StringValue; ADObjectIdWithString item = new ADObjectIdWithString(stringValue, adobjectIdWithString.ObjectIdValue); supervisionListForADRecipient.Remove(adobjectIdWithString); supervisionListForADRecipient.Add(item); } else { string stringValue2 = this.Tag.ToLower(); ADObjectIdWithString item2 = new ADObjectIdWithString(stringValue2, adRecipientToAdd.Id); supervisionListForADRecipient.Add(item2); } if (base.IsVerboseOn) { base.WriteVerbose(Strings.SupervisionListEntryAdded(this.Entry.ToString(), isGroup ? Strings.DistributionGroup : Strings.IndividualRecipient, this.Tag)); } }
protected PropertyValidationError FindADRecipientEntry(ADRecipient adRecipient, MultiValuedProperty <ADObjectIdWithString> supervisionList, out ADObjectIdWithString foundEntry, out string[] tags) { if (adRecipient == null) { base.WriteError(new ArgumentNullException("adRecipient"), (ErrorCategory)1000, null); } if (supervisionList == null) { base.WriteError(new ArgumentNullException("supervisionList"), (ErrorCategory)1000, null); } foundEntry = null; tags = null; foreach (ADObjectIdWithString adobjectIdWithString in supervisionList) { if (adobjectIdWithString.ObjectIdValue.Equals(adRecipient.Id)) { foundEntry = adobjectIdWithString; break; } } PropertyValidationError propertyValidationError = null; if (foundEntry != null) { SupervisionListEntryConstraint supervisionListEntryConstraint = new SupervisionListEntryConstraint(false); propertyValidationError = supervisionListEntryConstraint.Validate(foundEntry, null, null); if (propertyValidationError != null) { return(propertyValidationError); } tags = foundEntry.StringValue.Split(new char[] { SupervisionListEntryConstraint.Delimiter }); } return(propertyValidationError); }
protected PropertyValidationError FindExternalAddressEntry(SmtpAddress externalAddress, MultiValuedProperty <ADObjectIdWithString> supervisionList, out ADObjectIdWithString foundEntry, out string[] tags) { if (supervisionList == null) { base.WriteError(new ArgumentNullException("supervisionList"), (ErrorCategory)1000, null); } foundEntry = null; tags = null; SupervisionListEntryConstraint supervisionListEntryConstraint = new SupervisionListEntryConstraint(true); PropertyValidationError propertyValidationError = null; string[] array = null; foreach (ADObjectIdWithString adobjectIdWithString in supervisionList) { propertyValidationError = supervisionListEntryConstraint.Validate(adobjectIdWithString, null, null); if (propertyValidationError != null) { return(propertyValidationError); } array = adobjectIdWithString.StringValue.Split(new char[] { SupervisionListEntryConstraint.Delimiter }); SmtpAddress smtpAddress = new SmtpAddress(array[array.Length - 1]); if (smtpAddress.Equals(externalAddress)) { foundEntry = adobjectIdWithString; break; } } if (foundEntry != null) { Array.Resize <string>(ref array, array.Length - 1); tags = array; } return(propertyValidationError); }
// Token: 0x06000EFF RID: 3839 RVA: 0x000484C4 File Offset: 0x000466C4 private ADRawEntry ADRawEntryFromMservRecords(ulong puid, IList <MservRecord> mservRecords, IEnumerable <MServPropertyDefinition> properties, string originatingServerName, List <ValidationError> errors) { ADObjectId adobjectIdFromPuid = ConsumerIdentityHelper.GetADObjectIdFromPuid(puid); ADPropertyBag adpropertyBag = new ADPropertyBag(this.isReadOnly, 16); adpropertyBag.SetField(ADObjectSchema.Id, adobjectIdFromPuid); adpropertyBag.SetField(MServRecipientSchema.Puid, puid); foreach (MservRecord mservRecord in mservRecords) { object value = mservRecord; ProviderPropertyDefinition providerPropertyDefinition; switch (mservRecord.ResourceId) { case 0: if (mservRecord.SourceKey == null) { providerPropertyDefinition = MServRecipientSchema.MservPrimaryRecord; } else { providerPropertyDefinition = MServRecipientSchema.MservEmailAddressesRecord; value = new MultiValuedProperty <MservRecord> { mservRecord }; } break; case 1: providerPropertyDefinition = MServRecipientSchema.MservSoftDeletedPrimaryRecord; break; case 2: case 3: case 5: case 6: goto IL_D0; case 4: providerPropertyDefinition = MServRecipientSchema.MservCalendarRecord; break; case 7: providerPropertyDefinition = MServRecipientSchema.MservSecondaryRecord; break; case 8: providerPropertyDefinition = MServRecipientSchema.MservSoftDeletedCalendarRecord; break; default: goto IL_D0; } PropertyValidationError propertyValidationError = providerPropertyDefinition.ValidateValue(value, true); if (propertyValidationError != null) { errors.Add(propertyValidationError); } adpropertyBag.SetField(providerPropertyDefinition, value); continue; IL_D0: throw new NotSupportedException("Unexpected record received:" + mservRecord.ToString()); } ADRawEntry adrawEntry = new ADRawEntry(adpropertyBag); adrawEntry.OriginatingServer = originatingServerName; adrawEntry.WhenReadUTC = new DateTime?(DateTime.UtcNow); adrawEntry.IsCached = false; adrawEntry.ValidateRead(errors, properties); adrawEntry.ResetChangeTracking(true); return(adrawEntry); }
/// <summary> /// Initializes a new instance of the <see cref="PropertyError"/> class. /// </summary> /// <param name="error">The error</param> /// <param name="propertyName">Name of the property.</param> /// <param name="errorMessage">The message</param> public PropertyError(PropertyValidationError error, string propertyName, string errorMessage) { _PropertyName = propertyName; _PropertyValidationError = error; _ErrorMessage = errorMessage; }
/// <summary> /// Initializes a new instance of the <see cref="PropertyError"/> class. /// </summary> /// <param name="error">The error</param> /// <param name="propertyName">Name of the property.</param> public PropertyError(PropertyValidationError error, string propertyName) { _PropertyName = propertyName; _PropertyValidationError = error; }