Пример #1
0
        public SharepointValidationResult ValidateLocation(string location)
        {
            ArgumentValidator.ThrowIfNullOrWhiteSpace("location", location);
            if (SourceValidator.IsWideScope(location))
            {
                base.LogOneEntry(ExecutionLog.EventType.Verbose, "Skipping validation for wide scoped location '{0}", new object[]
                {
                    location
                });
                return(new SharepointValidationResult
                {
                    IsTopLevelSiteCollection = false,
                    IsValid = true,
                    SharepointSource = new SharepointSource(location, location, Guid.Empty, Guid.Empty)
                });
            }
            SharepointValidationResult result = null;

            try
            {
                if (this.validateUsingSearch)
                {
                    result = this.ValidateLocationBySearch(location);
                }
                else
                {
                    result = this.ValidateLocationByLoad(location);
                }
            }
            catch (Exception ex)
            {
                base.LogOneEntry(ExecutionLog.EventType.Error, ex, "Unexpected Exception occurred when Validating the location {0}. ValidatingUsingSearch: {1}", new object[]
                {
                    location,
                    this.validateUsingSearch
                });
                EventNotificationItem.Publish(ExchangeComponent.UnifiedComplianceSourceValidation.Name, "SharepointValidatorUnexpectedError", base.Client.ToString(), string.Format("Unexpected exception occured when validating the sites(using search:{0}). Exception:{1}", this.validateUsingSearch, ex), ResultSeverityLevel.Error, false);
                throw;
            }
            return(result);
        }
Пример #2
0
        private MultiValuedProperty <BindingMetadata> ValidateRecipientsImpl(IEnumerable <string> recipients)
        {
            MultiValuedProperty <BindingMetadata> multiValuedProperty = new MultiValuedProperty <BindingMetadata>();
            bool flag = false;

            this.warnedSkipInvalidTypeInGroup = false;
            if (recipients.Count <string>() > this.maxRecipientsLimit)
            {
                base.LogOneEntry(ExecutionLog.EventType.Error, "InvalidArgument: {0}", new object[]
                {
                    Strings.ErrorMaxMailboxLimit(this.maxRecipientsLimit, recipients.Count <string>())
                });
                base.WriteError(new ExValidatorException(Strings.ErrorMaxMailboxLimit(this.maxRecipientsLimit, recipients.Count <string>())), ErrorCategory.InvalidArgument);
            }
            else
            {
                foreach (string text in recipients)
                {
                    if (SourceValidator.IsWideScope(text))
                    {
                        base.LogOneEntry(ExecutionLog.EventType.Verbose, "Skipping validation for wide scoped value '{0}", new object[]
                        {
                            text
                        });
                        multiValuedProperty.Add(new BindingMetadata(text, text, text, SourceValidator.GetBindingType(text)));
                    }
                    else
                    {
                        RecipientIdParameter recipientIdParameter = RecipientIdParameter.Parse(text);
                        ReducedRecipient     reducedRecipient     = this.recipientGetter(recipientIdParameter, this.recipientSession);
                        if (ExchangeValidator.IsMembershipGroup(reducedRecipient) && this.allowGroups)
                        {
                            if (!flag)
                            {
                                if (base.ShouldContinue(Strings.ShouldExpandGroups))
                                {
                                    flag = true;
                                    base.LogOneEntry(ExecutionLog.EventType.Information, "Got confirmation to expand groups", new object[0]);
                                }
                                else
                                {
                                    base.LogOneEntry(ExecutionLog.EventType.Error, "User selected not to expand groups. {0}", new object[]
                                    {
                                        Strings.GroupsIsNotAllowedForHold(recipientIdParameter.RawIdentity)
                                    });
                                    base.WriteError(new ExValidatorException(Strings.GroupsIsNotAllowedForHold(recipientIdParameter.RawIdentity)), ErrorCategory.InvalidArgument);
                                }
                            }
                            if (flag)
                            {
                                this.ExpandGroupMembership(reducedRecipient, multiValuedProperty);
                            }
                        }
                        else
                        {
                            this.VerifyAndAddRecipient(reducedRecipient, multiValuedProperty, false);
                        }
                    }
                }
            }
            return(multiValuedProperty);
        }