Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

How to get a creation date from a SPListItem that is a folder in c#?

$
0
0

Hi,

I am making a visual webpart, and I download the SPListItems from a document library. I need to get the creation date of all the documents and folder items. I can do it successfuly for items that are documents and not folders using:

DateTime now = System.DateTime.Today;

TimeSpan diff = now - item.File.TimeCreated;

But if I try to do this for a item that is a folder, I get an exception about a null object. I think the "File" variable is null value.

Does anyone know how to get the creation date of a folder?

Thanks.




Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>