google-api-dotnet-client

Google PageSpeed API dotnet .net

孤者浪人 提交于 2019-12-10 17:55:39
问题 I have set up a basic C# application to run a PageSpeed test on a website that I specify using the Google.Apis.Pagespeedonline.v2 nuget package. The set up is simple enough and I have a variable that I can specify the url which is then past in to the Service // Create the service. var service = new PagespeedonlineService(new BaseClientService.Initializer { ApplicationName = "PageSpeed Sample", ApiKey = "[API_KEY_HERE]" }); var url = "URL_TO_TEST"; // Run the request. var result = await

List all Files and Folders from Google Drive V2 using .Net

六眼飞鱼酱① 提交于 2019-12-10 17:31:14
问题 I am creating an application using Google Drive API in .Net using the Google API .Net client library. In that list request get all files from root folder as well as from child folders and shared files. I don't want to list them all. I want list of files which are available in root folders only, not from sub folders. Hows that possible? My code is below : FilesResource.ListRequest listRequest = service.Files.List(); var files = listRequest.Execute(); for that I have define scope as var Scopes

Saving OAuth tokens from Google API response to database?

空扰寡人 提交于 2019-12-10 16:10:03
问题 I'm building an MVC app that will authenticate users on our website that want us to post events into their calendars. I've installed the .NET C# client library as well as the Auth and MVC packages. Using Google.Apis.Auth.OAuth2.Mvc I'm having trouble accessing the TokenResponse in my implementation of IDataStore , instead it saves the URL as the token i.e. localhost:6055/calendar/calendarasync/deantest04556734 All of the examples that I've found seem to be out of date, not using the Mvc

How to add a sheet in google sheets API v4 in C#?

南楼画角 提交于 2019-12-09 06:39:53
问题 I've been using Google Sheets API, and following The Google Guide. However there is no example, even beyond the second page of google, to add a worksheet and write to a new sheet in .NET. There is plenty for js, but I have no idea on how to 1) add a sheet or 2) write to a new sheet. How can I do this? Right now I'm able to read like in the example with out any problems, and I've only found one other reference to v4 C#. I tried going back to v3, but all documents strongly suggest using v4. Has

Cannot load System.Threading.Tasks assembly, using Google Calendar API

自古美人都是妖i 提交于 2019-12-09 06:27:36
问题 SOLVED ! Huge thank to Sam Leach Here is a sample of my working app.config file: <configuration> ... <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-2.5.19.0" newVersion="2.5.19.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Net.Http" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/

Google Admin Directory API: Add User Employee Details

∥☆過路亽.° 提交于 2019-12-08 20:58:33
I already have a working function for adding user using Google Admin Directory: string password = Random_Password(); User newuserbody = new User(); UserName newusername = new UserName(); UserOrganization newuserorg = new UserOrganization(); newusername.GivenName = GivenName; newusername.FamilyName = FamilyName; newuserbody.Name = newusername; newuserorg.Department = Department; newuserorg.CostCenter = Country; newuserorg.Title = JobTitle; newuserbody.Organizations = newuserorg; newuserbody.PrimaryEmail = GivenName + "." + FamilyName + email_suffix; //SET PASSWORD newuserbody.Password =

Google API Oauth2: Only one refresh token for all users?

China☆狼群 提交于 2019-12-08 14:46:50
问题 I am using OAuth2 Authentication, and I have a CMS with multiple users, each with their own profiles. It happens that our company has a Google account with access to multiple Analytics accounts. For each user who uses the CMS, I connect to the Google Analytics API using a different username, and each user’s token is saved in a database data store. The problem is, if one user disconnects and revokes his token, none of the other users who use the same Google account will be able to access the

Google cloud storage upload not working with C# API

隐身守侯 提交于 2019-12-08 13:07:41
I'm trying to upload a simple image to Google cloud storage via the C# API. It seems to succeed but I don't see anything in my Google cloud bucket. The code I have so far: Google.Apis.Services.BaseClientService.Initializer init = new Google.Apis.Services.BaseClientService.Initializer(); init.ApiKey = "@@myapikey@@"; init.ApplicationName = "@@myapplicationname@@"; Google.Apis.Storage.v1.StorageService ss = new Google.Apis.Storage.v1.StorageService(init); var fileobj = new Google.Apis.Storage.v1.Data.Object() { Bucket = "images", Name = "some-file-" + new Random().Next(1, 666) }; Stream stream =

ASP.NET using analytics Reporting API does not work on server

岁酱吖の 提交于 2019-12-08 11:50:13
问题 When I run my asp.net application on local host everything works great but when i publish my app on the web server this error shows up: Method 'ApplyAuthenticationToRequest' in type 'Google.Apis.Authentication.OAuth2.OAuth2Authenticator`1' from assembly 'Google.Apis.Authentication.OAuth2, Version=1.4.0.28223, Culture=neutral, PublicKeyToken=null' does not have an implementation. Here is part of the code that uses analytic ............................................. //This is the API url

How do I supply Header info such as Package Name and SHA1 in Google API request?

被刻印的时光 ゝ 提交于 2019-12-08 11:23:08
问题 I am trying to access Google API using dotNet SDK. When I don't have API restriction, I can just access and get JSON using the following code. I can still access with IP address restriction. But when I want to use with application restriction, I have to provide Package Name and SHA-1, which I already generated. I just don't know how to provide this header info when requesting API get. There are several ways to implement the credentials. By using the service account, I only need to provide