Solved

Date Range in Active Directory

Posted on 2011-02-24
5
249 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
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

839 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