Akash.P Akash.P - 1 year ago 98
C# Question

Get last modified date of latest file in a storage account

Scenario:program that can look at storage account and process all new & modified files and take an action if there is any new ones. For that i want to find the last modified date of the latest file .How can i achieve this?Anyone please help me.

namespace ListStorageAccntFiles
class Program
static void Main(string[] args)

CloudStorageAccount StorageAccount =
var BlobClient = StorageAccount.CreateCloudBlobClient();
var Container = BlobClient.GetContainerReference("samples‐workitems");

//Code to list the blobnames in Console
var list = Container.ListBlobs();
List<string> blobNames = list.OfType<CloudBlockBlob>().Select(b =>b.Name).ToList();

//Code for the remaining


Answer Source

Finally got the answer(simply last modified date of all files,not the specific latest file).

//Code to get the last modified date

CloudBlockBlob blockBlob = Container.GetBlockBlobReference(blobName);
var lastModifiedDate = blockBlob.Properties.LastModified;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download