This project is read-only.

Select next x birthdays

Jul 4, 2014 at 9:20 AM
How to query AD for next X birthdays?

I have users birthday stored in extentionAttribute1 as '31-08-1976'

would like to do something like

var user =
                (from u in
                     context.Query(new ADUser(), "OU=xxx,,DC=xxx", "User")
                         .WhereGreaterThanOrEqual(u.extensionAttribute1, DateTime.Now.ToShortDateString())
select new ADUser()
Jul 13, 2014 at 5:19 AM
Edited Jul 13, 2014 at 5:21 PM
From what I can tell that attribute is just a generic string. I believe your dates will have to be formatted as YYYY-MM-DD in order to appropriately compare the date. You will also want to map that attribute as a DateTime with a format "YYYY-MM-DD".

Here's an example (I'm not sure how you've mapped extensionAttribute1 on ADUser so I'm using the Filter class):
var date = new DateTime(1976, 8, 31).ToString("yyyy-MM-dd");
context.Query(new ADUser(), "OU=xxx,,DC=xxx", "User")
     .Where(_ => Filter.GreaterThanOrEqual(_, "extensionAttribute1", date, true))