我已经编写了我的示例控制台应用程序,它已被编译并很好地获取数据。现在我想将其作为 Azure 函数进行测试。以下是控制台应用程序中的代码块。如何将其重写为 Azure 的时间触发函数?谢谢。
using System;
using System.IO;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Services;
namespace Google.Apis.Samples
internal class MyData
{
[STAThread]
static void Main(string[] args)
{
Console.WriteLine("Blah Blah Blah");
Console.WriteLine("==============");
try
{
new MyData().Run().Wait();
}
catch (AggregateException ex)
{
foreach (var e in ex.InnerExceptions)
{
Console.WriteLine("Error: " + e.Message);
}
}
}
private async Task Run()
{
// I can either use service account or supply api key.
// How do I read a JSON file from Azure function?
// then I can Get data and display results.
}
}