.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

DirectorySearcher Filter Options - Multiple Groups in one Filter

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :Windows Application

Hi I'm looping through groups and displaying the user belonging to each group and I've just started working with the filter to exclude all groups except the one I specify in the filter like so:

Dim mySearcher As DirectorySearcher = New DirectorySearcher(eSecurity)
mySearcher.Filter = "(&(objectClass=user)(objectCategory=person)(memberof=CN=myGroupNameHere,OU=myOU,DC=myDC,DC=myDC))"

Is there a way I can extend the filter to select a number of groups like so:

mySearcher.Filter = "(&(objectClass=user)(objectCategory=person)(memberof=CN=myGroupNameHere,OU=myOU,DC=myDC,DC=myDC)(memberof=CN=myGroup2Here,OU=myOU,DC=myDC,DC=myDC))"

I've tried a few different arrangements of code, but haven't been successful yet. Does anyone know how or if I can use the filter in this way?

Hope you guys can help me out. I've found the information here indispensable!!

View Complete Post

More Related Resource Links

GridView Multiple Filter AJAX Control

This AJAX control enables the user to filter data within any column inside a GridView. The user can add multiple filters and can delete existing ones too.

LDAP nested groups filter


Hi all,

In my organization we use nested groups.

For a particular usage, we have a group (let's assume that the group name "kuku"), and the names of all the nested groups under it contains "kuku" as well.

We may assume that no other group in the LDAP has "kuku" in the name.

I need to create a filter which will return all the users which belong to one of the "kuku"s group.

Obviously, using this filter will bring only the head kukus

(&(&(objectclass=user)(objectclass=person))(memberOf=CN=kuku,cn=.rest of the group DN.))

How can I use wild card to fetch all users which belong to any kuku?

For example: (&(&(objectclass=user)(objectclass=person))(memberOf=CN=.*kuku.*))



Filter search over multiple text columns


Hi everyone,

I'm working on a library that stores information on various cases. The case table has several columns that contain descriptive strings on what happened in the case. I would like to create a single filter that returns all cases where the search string is found in any of the columns. I've looked at Dynamic Data Filtering, but as far as I can tell, the "Contains" filter only allows you to connect to each column individually. Has anyone tried this?



Excel 2007 Filter on multiple values

Hi Everyone,How do I use Excel 2007 Pivot Table's label filters/value filters to filter with multiple conditions? for example, I want to get all customers with customer name start with "G" and doesn't include "E" and with measure>100 and measure between 50-60.Regards,George

How to filter a List View by multiple values for one filter field?

Hi, I need to create a dynamically created link to a List View with a filter on one field, but with multiple values. Example: http://<server>/Lists/<list>/Allitems.aspx?FilterField1=Name&FilterValue1=John/Jack/Jonas which should give me all items where Name equals John, Jack or Jonas. Is this even possible?

group on or filter multiple datasets in 1 table?

I am fairly new to using BIDS, so please bear with me. I currently have 2 datasets, and 1 table.  The layout of the table is: Header HeaderGroup1 HeaderGroup2 Details FooterGroup2 FooterGroup2 Footer Group1 Footer Group1 Footer This is working, but what I need to do is figure out a way to add another Footer Group2 that includes an expression which involves either using data from a 3rd data set because of needing a different filter, or figuring out a way to filter the same data set twice in the one table.   I can give more specific info if you let me know what you need. Thanks!

Is there a way to query entity based on multiple filter criteria? WCF Data Services, Linq to Entiti


Instead of:

DW_CMSOPEN dwc = new DW_CMSOPEN(new Uri("http://acctdev02/WCFDataService/EmployeeService.svc"));

dwc.Credentials = System.Net.CredentialCache.DefaultCredentials;

var employees = from emp in dwc.Employees 
             where emp.DEPT == "123"
             select emp;

I'd like the linq query to resemble:

var employees = from emp in dwc.Employees
              where emp.DEPT // in {"123", "456", etc}
              select emp;

How to pass multiple filter parameters to moss report viewer from custom filter provider


I have written a custom filter provider webpart which implements ITransformableFilterValues to pass parameter value to moss report viewer webpart.

However, this interface only allows to pass one parameter. Please can someone guide me through correct resource which allows my custom filter provider webpart to pass multiple parameters to report viewer. E.g if my report has 5 parameters then my filter provider webpart should allow me to make connection with report viewer and pass all 5 parameters.

Cannot apply filter on SP dashboard using the 'Budgeting and Tracking Multiple Projects' template


The 'Budgeting and Tracking Multiple Projects'  template provides a dashboard that tracks all projects and their associated tasks/costs/issues etc. Unfortunately this does not filter by the project status so will be a continuous list forever long. I wanted to apply a filter such that only items where the status = Open is displayed. I tried this in SPD but adding filters would not work. If I add a rule to say = Open, nothing is displayed or if i enter != Complete then everything is displayed regardless. Additionally, sort conditions are not recognised either. a similar problem was posted on another forum with no answer. the problem is described in full detail.


Filter document library based on multiple lookup values



I have a very unique requirement for MOSS 2007.
Lets say there is a list of projects; A, B, C, etc.
Then there are phases of the project: Design, Develop, QA, etc.
When the documents are uploaded to a document library, a project and phase is selected at the time of check-in.
I want to create a project page to show project documents by showing documents for each phase in a different web part: eg. Design web part, Develop web part, etc. all bringing documents from the document library.
So far, all good. This can be created by using web parts, views and filters, etc.
Now, I want to create a custom list with Username, Project, Phase. like this:
User1, Project A, Design
User1, Project A, Develop
User1, Project A, QA
User1, Project B, QA

Now, if User1 goes to this project page for Project A - the user sees documents in all 3 phases.
if user1 goes to Project B - the user sees only QA documents.
I will be ok with just showing and hiding web parts completely.
or showing the web parts, but filtering out the documents. either is fine.

I have tried a combination of filters, CAML, etc. but getting values from a custom list to apply the filter is where I am stumped. I want the custom list as it will be easier for the end user to manage permissions for each user for each project for each phas

What is the most efficient way to filter on detail lines and have multiple detail lines displaying o



Here is my dilemma - i have 10 different sizes of, let's say, Tshirts in different stores.

I need a report that displays on one detail line a count of how many shirts of size 1 thru 3 i have in store A, B and C (the stores are the columns). and i need a second detail line displaying how many shirts of size 7 thru 9 i have in the same stores. How would i filter the data to display this most efficiently. Also, i will need to total the two lines at the end of the report.


             storeA     B         C

size 1-3      15        10     12

size 7-9     23         1        5


How to use DVWP to filter multiple columns in a document library


I am not new to SP, but newer to developing in SP, so I need some help please.

I am attempting to convert my company away from nested folders on SP. Elsewhere I saw a way to add multiple custom columns to a document library and then use a different web part (I thought the Form Web Part, but that only lets you filter on one column at a time) to filter the document library using those columns.

Ex: I have three columns:

* Market - with the checkbox choices being Employer, Public, Payer, and GovEduLab. A document could be a part of all, some or one of those markets.
* Product - with the checkbox choices being Care Solutions and Behavioral Solutions. A document could be a part of all, some or one of those markets.
* Process - again, checkbox choices being Account Planning, Commissions, Contracts, etc. And again, the doucment could be a part of all, some or one of those markets.

I want to create something that will allow the user to use some kind of "form" to filter find any document that is a Public-Care Solutions-Contract document and only show thsoe documents in the library.

This is what I have been trying to make it look like, but I am not tied to this:


Filter on Multiple Dimensions




I am trying to get a value of measure based on 2 conditions from 2 dimensions. So what I want is No of Hours (Measure) when Account from [COA AHC] dimension = 902000 and Account Unit from [Levels] dimension is 1400. Here is what I have:

select [Measures].[No Of Hoursin Period] on 0,





I keep getting an error. What am I doing wrong? Please help me.



Using jQuery to Filter Table Rows

The project is using the .net GridView control, so I had limited control over the output HTML code. Still, I think this code can work for most tables. One thing to notice: you should use the class "filterable" on your table or on one of its parents for the code to work.
First, we need a text box:

Where to Filter the companies returned by the EF?



I am just starting with dynamic data. I have an enttity framework called UsersModel.edmx.

It returns a list of all companies in the tblCompany table. This list is really big.

I need to filter the list returned to all user controls on the client so that it only returns the company that have a CompanyTypeId= 2 or CompanyTypeId= 3 and company name != "".

1 - Is it possible to filter the company list returned on the server so that I can filter only once for all the controls that use that on the client?

My ideas was to do something like this using linq and lambda but I am not sure how:

return tblCompanys.Where(c => c.CompanyTypeId == 2 || c.CompanyTypeId == 3 && ).Where(c=>c.CompanyName != "").OrderBy(c => c.CompanyName).Distinct().OrderBy(c=>c.CompanyName);

2 - I have created a partial class and a metadata class and added the DisplayColumn attribute to use the company name and sort by company name ascending.

Could I use the code to filter the returned companies in this? where?

namespace MarsMedicalModel
    [DisplayColumn("CompanyName", "CompanyName")]
    public partial class t

Filter by Computed Column



After looking for a driver to open legacy dbf drivers to connect, the next level trouble a have is this one:

first, i can retrieve the data but when trying to filter by a parameter (somesc columns) i get an error.

The error says about the database can't determine some blah blah!

The error is a columm tha is formated (  1234  ) about  8 space, fixed. The values in the query appears like that. I resolve this by Trimming Ltrim(ColumnName) and i get this (1234).

Now in SqlExpress, how can i filter by the new Trimmed Expression? (This is a primary key that the DBF use)


SELECT column1, column2, column3


SELECT Ltrim(column1) as NewExp, column2, column3
Where NewExpre = @NewExpres                  -Error-


Urgently Need Help : Unrecognized Tag Prefix or device filter 'CR'


I have download and installed the Crystal Report for 2010 from my Visual Studio 2010. 


Problem 1 :

When I create a new crystal report in the Project, the aspx created code below :

<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server"
            AutoDataBind="True" GroupTreeImagesFolderUrl="" Height="1202px"
            ReportSourceID="MemberList" ToolbarImagesFolderUrl="" ToolPanelWidth="200px"
            Width="1104px" />
        <CR:CrystalReportSource ID="MemberList" runat="server">
            <report filename="MemberList.rpt">

 but there is error : unrecognized tag prefix or device filter 'CR'


Problem 2 :

The vb code of the crystal report that I had created has 'ComponentModel is not a member of 'MYPROJECT.system'



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend