protected override void ValidateWrite(List <ValidationError> errors) { base.ValidateWrite(errors); if (this.SourceMailboxes.Contains(base.Id.MailboxOwnerId)) { errors.Add(new PropertyValidationError(ServerStrings.DiscoveryMailboxCannotBeSourceOrTarget(base.Id.MailboxOwnerId.DistinguishedName), SearchObjectSchema.SourceMailboxes, this.SourceMailboxes)); } if (this.TargetMailbox != null) { if (this.SourceMailboxes.Contains(this.TargetMailbox)) { errors.Add(new PropertyValidationError(ServerStrings.SearchTargetInSource, SearchObjectSchema.TargetMailbox, this.TargetMailbox)); } if (this.TargetMailbox.Equals(base.Id.MailboxOwnerId)) { errors.Add(new PropertyValidationError(ServerStrings.DiscoveryMailboxCannotBeSourceOrTarget(base.Id.MailboxOwnerId.DistinguishedName), SearchObjectSchema.TargetMailbox, this.TargetMailbox)); } } if (this.StartDate != null && this.EndDate != null && this.StartDate > this.EndDate) { errors.Add(new PropertyValidationError(ServerStrings.InvalidateDateRange, SearchObjectSchema.StartDate, this.StartDate)); } KindKeyword[] second = new KindKeyword[] { KindKeyword.faxes, KindKeyword.voicemail, KindKeyword.rssfeeds, KindKeyword.posts }; if (this.MessageTypes.Intersect(second).Count <KindKeyword>() > 0) { errors.Add(new PropertyValidationError(ServerStrings.UnsupportedKindKeywords, SearchObjectSchema.MessageTypes, this.MessageTypes)); } if (!string.IsNullOrEmpty(this.SearchQuery)) { try { AqsParser aqsParser = new AqsParser(); aqsParser.Parse(this.SearchQuery, AqsParser.ParseOption.None, this.Language).Dispose(); } catch (ParserException ex) { errors.Add(new PropertyValidationError(ex.LocalizedString, SearchObjectSchema.SearchQuery, this.SearchQuery)); } } }
private bool InternalTryAqsMatch(IList <StoreObjectId> storeIds, string searchString, CultureInfo cultureinfo, out IList <string> bodySearchString, out List <IConversationTreeNode> nodes) { nodes = null; bodySearchString = null; AqsParser aqsParser = new AqsParser(); using (Condition condition = aqsParser.Parse(searchString, AqsParser.ParseOption.SuppressError, cultureinfo)) { bodySearchString = Conversation.ConditionToBodyQueryString(condition); if (bodySearchString == null || bodySearchString.Count < 1) { nodes = this.MatchAllNodes(storeIds); return(true); } } return(false); }