The "datenoyear" field in the SharePoint user profiles

 

At the moment I'm working on the new and improved version of the Macaw Birthday web part.

This web part uses the Birthday field of the user profile to query for people who will have their birthday in the next "x" days. Where you can set "x" from the web part property pane. There's a bunch of other stuff that can be set from the pane, but that's not causing problems right now.

The SQL queries you can perform against the MOSS 2007 index do not only support negative date comparisons on complete dates. This looks like (from the SDK):
...WHERE LastModifiedTime <=DATEADD (DAY, -5, GETGMTDATE())

Which means that you can only compare against dates in the past, where I want to find dates from today till "x" days from now, and I want to disregard the year, which is also not possible.

This is my next problem. Even though the class is called datenoyear it stores a year with it when you save it. And when you use the search objects to retrieve the field it returns a year with that. In my case it always returns the year 2000. If I can be sure that this is the year that is always added to a datenoyear field that would help a lot because then I would no that I need to query for a date between today in 2000 till today +"x" in 2000. But I can't find any documentation on that.

Other possible approaches are the DataColumn Expressions and the DataView RowFilter, but that will only work if I know for sure that the year will always be 2000. In that case I can query for each day separately like:
DataView.RowFilter = "Birthday = #5/13/2000# OR Birthday = #5/14/2000# OR Birthday = #5/15/2000# OR Birthday = #5/16/2000#"
if "x" would have been four.

Right now I think I'm just going to filter when writing the HTML, which means that I have a DataTable with all user profiles present on the environment, instead of just the user profiles of the people who have their birthday in the next "x" days, but I'm out of inspiration right now. If anyone has another suggestion I would appreciate that..
Oh, and if anyone can tell me for sure that the year stored for datenoyear fields is 2000 than I would be grateful for that information as well...

Print | posted @ Tuesday, May 13, 2008 1:56 PM

Comments on this entry:

Gravatar # re: The &quot;datenoyear&quot; field in the SharePoint user profiles
by Michiel Lankamp at 5/13/2008 4:03 PM

I can tell you for sure that the date isn't allways 2000, when a user updates his own profile the current year is used.
  
Gravatar # re: The &quot;datenoyear&quot; field in the SharePoint user profiles
by Mirjam at 5/19/2008 11:57 AM

Hi Michiel,

In my environment, if the user updates it's own profile the year is still 2000...

Regards,
Mirjam
  
Gravatar # re: The &quot;datenoyear&quot; field in the SharePoint user profiles
by Mirjam at 5/19/2008 12:00 PM

Hi Victor,

In real SQL there would be no problem, but it's the possibilities of the MOSS FullTextSqlQuery object that are bugging me. I also use the C# filtering now, but it's such a waste to load all profiles..
And yes, I'm also enabling output templates ;-)

Regards,
Mirjam
  
Gravatar # re: The &quot;datenoyear&quot; field in the SharePoint user profiles
by Mirjam at 1/30/2009 10:10 AM

Hi Duarte,

Cool solution! I didn't know you could actually manipulate the year that is stored in the datenoyear field.

Mirjam
  

Your comment:

Title:
Name:
Email:
Website:
 
Italic Underline Blockquote Hyperlink
 
 
Please add 2 and 4 and type the answer here: