Solved

Date Range in Active Directory

Posted on 2011-02-24
5
258 Views
Last Modified: 2012-05-11
I was trying to find some example to retrieve user based on Date Range.

For Eg: if i give a date like 1/01/2011 to 31/01/2011 in my windows application.

I wanna retrieve the user info , created on these date ranges.

For Eg: User Bob Created on 15/01/2001,then i have to retrieve that user name.

but am not sure what's the "Search Filter" for that.

Any help appreciated
0
Comment
Question by:Sha1395
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 2

Expert Comment

by:ramkihardy
ID: 34968667
HI,
    get the dates entered by the user and convert it to datetime....
like this
Get the Date from the two date fields and convert them to DateTime by using Convert.ToDateTime(DateFiledValue) write a query like this
string SQL=Select Username from UserMst where name='Bob' and Created on between 'Converted From Date Field Value ' AND 'Converted To Date Field Value'.....
This query will give the desired result............
If Any Help please Let me know...
Mark it as answer if it is helpful...
With Regards



0
 

Author Comment

by:Sha1395
ID: 34968730
Hi Ramki,

Am not querying SQL,i havey to Query Active Directory.
0
 
LVL 2

Accepted Solution

by:
ramkihardy earned 250 total points
ID: 34968806
Sorry shah...I didnt noticed it....i have also a another solution...use can query active directy from your sql server...see this example......http://support.microsoft.com/kb/319716.....and also this might be very helpfull.http://www.codeproject.com/KB/system/everythingInAD.aspx...
pls let me know if u want anyother....
0
 

Author Comment

by:Sha1395
ID: 34968877
Thanks Ramki,

I checked codeproject,none of them give an example or syntax for "date range" search filter.

I can't use Sql Server,bcoz my requirement is to write a Class Library file (DLL) on C#.

Appreciated for your help
0
 
LVL 53

Assisted Solution

by:Dhaest
Dhaest earned 250 total points
ID: 34978442
Perhaps you can retrieve all the users (without the date-range) and check this in an if-statement to see if the user is created within these dates?

if(user.properties["whenCreated"].value > StartDate && user.properties["whenCreated"].value < EndData)
{
user.properties["whenCreated"].value.ToString()
}
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question