google-api-dotnet-client

Update a Cell with C# and Sheets API v4

被刻印的时光 ゝ 提交于 2019-11-29 05:46:07
Does anyone have a good C# example for updating a cell with the v4 API? I have the get cell values c# example from the developer website working with Google Sheets API v4. I am trying to modify the example to update a cell with a value of "Tom". I'm stuck on the settings for SpreadSheets.Values.Update . using Google.Apis.Auth.OAuth2; using Google.Apis.Sheets.v4; using Google.Apis.Sheets.v4.Data; using Google.Apis.Services; using Google.Apis.Util.Store; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading; using System

Google .NET APIs - any other DataStore other than the FileDataStore?

这一生的挚爱 提交于 2019-11-28 21:13:27
I'm using the Google .NET API to get analytics data from google analytics. this is me code to start the authentication: IAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer { ClientSecrets = new ClientSecrets { ClientId = googleApiClientId, ClientSecret = googleApiClientSecret }, Scopes = new[] { Google.Apis.Analytics.v3.AnalyticsService.Scope.AnalyticsReadonly }, DataStore = new Google.Apis.Util.Store.FileDataStore("Test_GoogleApi") }); it users the FileDataStore which stores in local user profile as a file. I'm running this code inside an

How to programmticly remove a file from “share wtih me” in Google drive

☆樱花仙子☆ 提交于 2019-11-28 14:23:10
Doing the following command with the full drive scope var request = service.Files.Delete(fileId); results in insufficient permission error. When trying to delete a file from google drive "Shared with me" folder. How do you delete a file from shared with me when the user that is logged in does not actually have access to delete a file they dont own. The problem is that the user in question doesnt own the file. After a lot of digging a relised what you want to do is remove the permissions for the user on the file. The first thing you need to do is run an about.get on the current user return

Google Admin SDK Unable to Create User - Exception 403 Forbidden

浪子不回头ぞ 提交于 2019-11-28 14:09:33
I am trying to create a user using C# and the google-admin-directory_v1-rev24-csharp-1.7.0-beta client libraries however I keep geting an exception: Google.GoogleApiException was unhandled HResult=-2146233088 Message=Google.Apis.Requests.RequestError Not Authorized to access this resource/api [403] Errors [ Message[Not Authorized to access this resource/api] Location[ - ] Reason[forbidden] Domain[global] ] Source=Google.Apis ServiceName=admin StackTrace: at Google.Apis.Requests.ClientServiceRequest`1.Execute() in c:\code\google.com\google-api-dotnet-client\default\Tools\Google.Apis.Release\bin

How to provide Credentials programmatically to use google drive api in c# or vb.net?

半城伤御伤魂 提交于 2019-11-28 09:06:16
问题 I made a program that uses google drive api to read data from a file on google drive. the first time you run the app it opens a web browser asking to sign in with google drive account. I want to provide the app the username and password so that it get the credentials automatically, so that users won't need to know the username and password of my google drive account. here is the code in vb.net: Dim credential As UserCredential Using stream = New FileStream("client_secret.json", FileMode.Open,

Google Analytics OAuth with AccessType = Offline in C#

夙愿已清 提交于 2019-11-28 08:50:18
I want to use Google Analytics API using OAuth. I am using this library: http://code.google.com/p/google-api-dotnet-client/ The following code is used for authentication: var credential = GoogleWebAuthorizationBroker.AuthorizeAsync( new ClientSecrets { ClientId = "...", ClientSecret = "..." }, new[] {Google.Apis.Analytics.v3.AnalyticsService.Scope.AnalyticsReadonly}, "user", CancellationToken.None, new FileDataStore("Analytics.Auth.Store")).Result; var service = new Google.Apis.Analytics.v3.AnalyticsService( new BaseClientService.Initializer { HttpClientInitializer = credential,

Google OAuth access token expiration in MVC app?

两盒软妹~` 提交于 2019-11-28 08:44:09
I wrote an MVC app using Google Oauth2 as instructed here: https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth#web_applications I have an issue with access token expiration. When access token expires, I get the exception when calling Google API: "The access token has expired but we can't refresh it" The initial authentication is two iterations mechanism: first iteration AuthorizeAsync returns result with empty Credential, and populated RedirectUri: So, the authorization url created is this: https://accounts.google.com/o/oauth2/auth?access_type=offline&response_type=code

ASP.net app crashes - Could not load file or assembly 'Microsoft.Threading.Tasks.Extensions.Desktop'

孤街醉人 提交于 2019-11-28 07:32:55
I want to build a Google BigQuery C# ASP.net application using OAuth2 and the .Net 4.5 framework. I ran these NuGet installs Install-Package Google.Apis.Bigquery.v2 -Pre Install-Package Google.Apis.Authentication.OAuth2 -Version 1.2.4696.27634 Install-Package Google.Apis -Pre Install-Package Google.Apis.Auth -Pre and I placed the relevant "usings" in code-behind file "default.aspx.cs": using System; using System.Collections.Generic; using System.IO; using System.Threading; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Google.Apis.Auth.OAuth2; using Google.Apis

where can i find ServiceAccountCredential

本秂侑毒 提交于 2019-11-28 03:26:15
问题 I am working in google api with asp.net c#, My goal is access google api using service account. I have imported all needed dlls to create service account to access admin features(admin sdk). But i couldn't find ServiceAccountCredential. How can i implement this in my project? 回答1: Here's how you do it in 2017: Go to the Service Accounts page Create a private key for the service account as a JSON file Put the downloaded file in your project (for development) or bake it in your build process

Google+ insert moment using google-api-dotnet-client

心已入冬 提交于 2019-11-28 01:44:50
I am trying to write an activity in Google+ using the dotnet-client. The issue is that I can't seem to get the configuration of my client app correctly. According to the Google+ Sign-In configuration and this SO question we need to add the requestvisibleactions parameter. I did that but it did not work. I am using the scope https://www.googleapis.com/auth/plus.login and I even added the scope https://www.googleapis.com/auth/plus.moments.write but the insert still did not work. This is what my request url looks like: https://accounts.google.com/ServiceLogin?service=lso&passive=1209600&continue