public static async Task <List <ObjectInfo> > GetAllObject([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest req, ExecutionContext context, ILogger log, ClaimsPrincipal claimsPrinciple) { try { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); var item = await CloudTableExtensions.GetAllObject(claimsPrinciple.Identity.Name); stopWatch.Stop(); var metrics = new Dictionary <string, double> { { "processingTime", stopWatch.Elapsed.TotalMilliseconds } }; TelemetryClient telemetryClient = telemetryFactory.GetClient(context); telemetryClient.TrackEvent("get-all-objects", metrics: metrics); //return req.CreateResponse(HttpStatusCode.OK, item); return(item.Select(i => i.MapFromTableEntity()).ToList());; } catch (Exception ex) { throw ex; } }
public static async Task Run([TimerTrigger("0 0 * * * *")] TimerInfo myTimer, ILogger log, ClaimsPrincipal claimsPrinciple) { try { log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}"); //Send Email At each 24 hour var item = await CloudTableExtensions.GetAllObject(claimsPrinciple.Identity.Name); var json = Newtonsoft.Json.JsonConvert.SerializeObject(item); var emailSender = new EmailSender(); await emailSender.SendEmailAsync(FunctionsSettings.ToEmail, "Azure function poc Data", json); log.LogInformation("Email Send"); } catch (Exception ex) { throw ex; } }