Solved

Date Range in Active Directory

Posted on 2011-02-24
5
244 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
Comment Utility
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
Comment Utility
Hi Ramki,

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

Accepted Solution

by:
ramkihardy earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: Ivo
Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now