Exemple #1
0
        public async Task <ActionResult> Index()
        {
            var service = await GoogleDriveHelper.AuthenticateServiceAccount("*****@*****.**", HttpRuntime.AppDomainAppPath + "Kia feed-69b23139ac76.p12");

            var filePath = HttpRuntime.AppDomainAppPath + "Kia feeds.xlsx";
            var file     = await GoogleDriveHelper.UploadFile(service, filePath, "");

            var files = await GoogleDriveHelper.GetFiles(service);

            return(View());
        }
Exemple #2
0
        /// <summary>
        /// https://github.com/LindaLawton/Google-Dotnet-Samples/tree/master/Google-Drive
        /// </summary>
        /// <param name="context"></param>
        public async void Execute(IJobExecutionContext context)
        {
            // connect with a Service Account
            const string serviceAccountEmail   = "*****@*****.**";
            var          serviceAccountkeyFile = Path.Combine(HttpRuntime.AppDomainAppPath, "Temp", "My Project-b1363c7ae5f1.p12");
            var          service = await GoogleDriveHelper.AuthenticateServiceAccount(serviceAccountEmail, serviceAccountkeyFile);

            var uploadFile = Path.Combine(HttpRuntime.AppDomainAppPath, "Temp", "Kia  feed#1.xlsx");

            await GoogleDriveHelper.UploadFile(service, uploadFile, "Kia vehicle feeds");
        }