Hello @Muhammad Guruh Ajinugroho
Thanks for posting your question here.
You can use the Azure Blob Storage SDK to read the metadata of a blob or a container, including the datemodified property. Here's an example of how to get the datemodified property for a blob:
Also, you can use the Azure Blob storage trigger for Azure Functions to read the folder metadata and structure in your container.
To read the folder metadata, you can use the LastModified property of the BlobProperties class in the Azure Functions runtime. This property returns the date and time that the blob was last modified. You can use this property as the trigger for your function.
To read the folder structure, you can use the path property in the trigger configuration. The path property allows you to specify a pattern for the blobs that you want to trigger your function. For example, you can use the following pattern to trigger your function only when a new file is added to the SUB_A folder:
"path": "root-folder/SUB_A/{name}"
In your function code, you can use the name variable to access the name of the blob that triggered the function. You can then use this information to generate the message to be sent to the client devices.
Here's an example of how you can implement a Blob storage trigger function in Azure Functions which might need some customization based on your need:
using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
using Microsoft.WindowsAzure.Storage.Blob;
public static class BlobFunction
{
[FunctionName("BlobFunction")]
public static void Run(
[BlobTrigger("root-folder/SUB_A/{name}", Connection = "AzureWebJobsStorage")] CloudBlockBlob blob,
string name,
ILogger log)
{
log.LogInformation($"C# Blob trigger function processed blob\n Name:{name} \n Blob Size: {blob.Properties.Length} Bytes");
// Read the folder metadata
var lastModified = blob.Properties.LastModified;
// Generate the message to be sent to the client devices
var message = GenerateMessage(name, lastModified);
// Send the message to the client devices
SendMessage(message);
}
private static string GenerateMessage(string name, DateTime lastModified
Reference Documents:
Hope this helps, please let me if any questions.
Please "Accept as Answer" and Upvote if it helped, so that it can help others in the community looking for help on similar topics. Thank you!