I am making a visual webpart in SP 2010, 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.