Ejemplo n.º 1
0
        public override void ExecuteCmdlet()
        {
            ADObjectFilterOptions options = new ADObjectFilterOptions
            {
                SearchString = SearchString,
                UPN          = UserPrincipalName,
                Id           = ObjectId == Guid.Empty ? null : ObjectId.ToString(),
                Paging       = true
            };

            do
            {
                WriteObject(ActiveDirectoryClient.FilterUsers(options), true);
            } while (!string.IsNullOrEmpty(options.NextLink));
        }
        protected override void ProcessRecord()
        {
            ADObjectFilterOptions options = new ADObjectFilterOptions
            {
                SearchString = SearchString,
                UPN          = UserPrincipalName,
                Id           = ObjectId == Guid.Empty ? null : ObjectId.ToString(),
                Paging       = true,
                Mail         = Mail
            };

            do
            {
                WriteObject(ActiveDirectoryClient.FilterUsers(options), true);
            } while (!string.IsNullOrEmpty(options.NextLink));
        }
Ejemplo n.º 3
0
        public override void ExecuteCmdlet()
        {
            ExecutionBlock(() =>
            {
                ADObjectFilterOptions options = new ADObjectFilterOptions
                {
                    SearchString = this.IsParameterBound(c => c.StartsWith) ? StartsWith + "*" : DisplayName,
                    UPN          = UserPrincipalName,
                    Id           = ObjectId == Guid.Empty ? null : ObjectId.ToString(),
                    Paging       = true,
                    Mail         = Mail
                };

                ulong first = MyInvocation.BoundParameters.ContainsKey("First") ? this.PagingParameters.First : ulong.MaxValue;
                ulong skip  = MyInvocation.BoundParameters.ContainsKey("Skip") ? this.PagingParameters.Skip : 0;
                WriteObject(ActiveDirectoryClient.FilterUsers(options, first, skip), true);
            });
        }
        public override void ExecuteCmdlet()
        {
            ExecutionBlock(() =>
            {
                ADObjectFilterOptions options = new ADObjectFilterOptions
                {
                    SearchString = this.IsParameterBound(c => c.StartsWith) ? StartsWith + "*" : DisplayName,
                    UPN          = UserPrincipalName,
                    Id           = ObjectId,
                    Paging       = true,
                    Mail         = Mail
                };
                if (!string.IsNullOrEmpty(options.SearchString))
                {
                    //query string is wrapped with single quote. Escape is needed if it contains additional quote.
                    options.SearchString = options.SearchString.Replace("'", "''");
                }


                ulong first = MyInvocation.BoundParameters.ContainsKey("First") ? this.PagingParameters.First : ulong.MaxValue;
                ulong skip  = MyInvocation.BoundParameters.ContainsKey("Skip") ? this.PagingParameters.Skip : 0;
                WriteObject(ActiveDirectoryClient.FilterUsers(options, first, skip), true);
            });
        }