I am using C# to create an Azure function using a QueueMessage trigger. I want to get the insertion time of the queue message.
In the code that runs the the function I have access to the message body as a string, as per the standard signature from the template in Visual Studio:
[QueueTrigger("url-content-300", Connection = "AzureWebJobsStorage")]string myQueueItem
However I want to get the insertion time of the message.
In the Python template it gives me the whole message queue object like the following:
msg: func.QueueMessage
which I can then deserialise as a Json Object:
result = json.dumps({
'id': msg.id,
'body': msg.get_body().decode('utf-8'),
'expiration_time': (msg.expiration_time.isoformat()
if msg.expiration_time else None),
'insertion_time': (msg.insertion_time.isoformat()
if msg.insertion_time else None),
'time_next_visible': (msg.time_next_visible.isoformat()
if msg.time_next_visible else None),
'pop_receipt': msg.pop_receipt,
'dequeue_count': msg.dequeue_count
})
insertionTime = result.insertion_time
How do I do that in C# ?