Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Wednesday, January 21, 2015 12:31 PM
After uploading file into Azure blob storage I could see original file time stamp is lost.
Some how I need to preserve original file time stamp. Azure blob storage doesn't allow to programmatically update "Last Modified Date".
Please share if any one has come across this situation before.
All replies (3)
Thursday, January 22, 2015 7:26 AM âś…Answered | 2 votes
Hi,
If you want to upload a file with date informaion, please try to use SetMetadata().
DateTime date = DateTime.Now;
using (var filestream = File.OpenRead(@"D:\test.txt"))
{
block.UploadFromStream(filestream);
block.Metadata["lastmodifydate"] = date.ToString();
block.SetMetadata();
}
block.FetchAttributes();
string dateInfo= block.Metadata["lastmodifydate"];
If this doesn't help you, please try to log a file information entity to azure table.
Best Regards,
Jambor
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.
Thursday, January 22, 2015 2:49 AM
Hi,
Please try to set properties when you upload file to azure blob via call SetProperties method or SetProperties method. To read properties on a container or blob, call the FetchAttributes method, then retrieve the property value. Refer to https://msdn.microsoft.com/en-us/library/azure/hh425342.aspx for more details.
Best Regards,
Jambor
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.
Thursday, January 22, 2015 4:43 AM
Hi Jambor,
I tried below code
CloudBlockBlob blob = container.GetBlockBlobReference(fileName);
blob.Properties.LastModified = lastWriteTimeUtc;
blob.SetProperties();
But LastModified is a read-only property and we can't set this property