Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

In OOB SharePoint, many of the lists render a "New" graphic when an item is "New". I found this posting which indicates how to determine this from an XSL file: http://e-junkie-chronicles.blogspot.com/2010/04/sharepoint-new-image-graphic-show-users.html

Is there a way to get at the "New" functionality through the SharePoint API/Object Model that respects the SharePoint settings? For example, an IsNew property?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Have you had a look at the the SPWebApplication.DaysToShowNewIndicator? Could do a comparison with that and the Created Date of the ListItem.

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebapplication.daystoshownewindicator.aspx

share|improve this answer
    
This looks like it will work. A side note, you must be careful about the RegionalSettings for the web and how the SPListItem returns it's "Created" (and also "Modified") fields. Comparing them to DateTime.Now is probably not valid if your site is accessed by users not in the TimeZone specified for the SPWeb. See this: msdn.microsoft.com/en-us/library/ms197282.aspx and this msdn.microsoft.com/en-us/library/… –  Brian Sep 10 '10 at 12:09
    
Very good point Brian, thanks. I've added another Postscript to my blog post about this. –  James Love Sep 10 '10 at 12:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.