Google Apps Script : retrieving Working Location from calendar - google-apps-script

a recent feature in Google Calendar allows users to select a working location (home, office, other) for every working day.
Do you know if there is a way to retrieve this info using Apps Script ?
Thanks
Mathieu

Answer:
This is currently not available to the API.
Reference:
Here is a list of all the settings available to the API: Settings.
You can notice that many settings from https://calendar.google.com/calendar/u/0/r/settings are not available, including Enable working location. Since this is a very recent feature, it's not strange that it hasn't yet been added to the API.
There is a Feature Request:
Another user suggested this feature to be implemented in the Calendar API. You can click on the star next to the issue number to give more priority to the request and to receive updates:
https://issuetracker.google.com/199918380

Related

Get Google Drive video view count from Apps Script API?

I have a series of videos uploaded to a specific Google Drive folder, and I'd like to get the view count for each video/file. Literally as simple as "file_id" "10 views".
From extensive research, it seems this is quite simply impossible within Google Apps Script today? Per this old answer, both the Drive API and the Drive Activity API only report edit or comment activity, while view activity is ignored. The Reports API does support this, but only for users with Admin access in an Enterprise account (not for us plebes who just want to know view counts on our own files).
And per this Apps Script documentation, it seems that onOpen() triggers don't run for views (which blocks a "view_count + 1 on open of this specific file" sort of analytics).
Before I give up, I figured I'd run it past this brilliant community: am I missing anything? Is there some way to get view count on videos stored and accessed through Google Drive?
Answer:
You are correct in your findings that you can not get video view count information through the Drive API. You must use the Admin SDK to obtain this information.
Feature Request:
You can however let Google know that this is a feature that is important for access to their APIs, and that you would like to request they implement it.
Google's Issue Tracker is a place for developers to report issues and make feature requests for their development services, I'd urge you to make a feature request there. The best component to file this under would be the Google Drive component, with the Feature Request template.

Service invoked too many times: translate. What is the quota?

I am receiving this error message "Service invoked too many times: translate" in my google apps script. My script is running every 5 minutes. How could I find what is the quota ?
Is there a way to increase this limit ?
I have not had this problem in the last days. It just appeared today.
Many thanks!
Go to your Google Developers Console Dashboard. Select your project, then click on "APIs" in the left-hand menu. On that screen, click on the "Enabled APIs" tab.
If you don't have never used Google Developers Console, then step one would be to sign up. Then, create a new project, enable the Translate API, use the API keys provided during the setup in your project. Now you can track your usage.
However, I believe the Google Translate API is a Paid-for-only API. That could be your core problem?

Publish a Google script for several documents

I recently created a Google script for my documents but I'd like to know how to authorize all my documents to execute this one, not only the document that I used to develop the script...
First, Is that possible without passing on the store?
I have great news for you! Google says they're working on that!
But also bad news. They've been working on it for four years now, which really means they're not working on it.
See Issue 489, star it and wait for the announcement of project completion. He he!
The topic of sharing scripts among multiple documents has been covered before:
https://stackoverflow.com/questions/5334751/how-do-i-share-a-script-i-wrote-with-my-co-workers-on-the-same-google-apps-accou?rq=1
Libraries.
How to share one Google Apps script between few documents?
Libraries.
What happened to the "Publish to Gallery" option in Google Apps Script?
The gallery was retired.
Google Apps Script add code to copy of a document
Can't do it.
Option 1: As those previous answers suggested (and I'm sure there are more), turn your script into a library, then in every document you want to use it you "just" need to add a script that includes the library, and functions that call the library functions.
Option 2: Any stand-alone script can be "tested as an add-on", which allows you to associate a script with any document. Unfortunately, just one document at a time.
Option 3: (Your own suggestion.) You are able to publish through the store, but limit the visibility just to yourself (any account), people with the link (any account) or your organization (domain accounts). If you're using a consumer account, you'll have to pay $5 to register as a developer for this privilege.
I'm uncertain about whether you'd need to wait for a review cycle, or if your add-on would go live immediately, or if you'd be able to skip providing help documentation, support web site, etc. - maybe someone else can weigh in on that via comment, and / or update this answer with details.
The advantage to this would be the ability to have the script in any of your documents, without adding scripts to them.
Consumer account add-on visibility options:
Corporate domain account:

Pulling Google Apps user creation date

What options are there to pull a GApps user creation date?
I saw that the Admin SDK is capable of it, is it the only API capable of doing this? does any of the previous one also capable of?
If possible using GAS, it will be most excellent,
Thank you!
Indeed there does not seem be Google Apps Script services to pull the creation date. The DomainUser class provide interesting functionality for interacting with domain users (only for admins).
Using the Admin SDK with Google Apps Script using UrlFetchApp.addOAuthService is not as complex as it looks. You can read this answer which will throw some light on how you can use external API calls for certain Google API and bring the data to Google Apps Script.
The scope for the ADMIN SDK will be as follows
oAuthConfig1.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken
?scope=https://www.googleapis.com/auth/admin.directory.user.readonly");
Notice that in this case I have requested a readonly scope.

Google API Service Accounts with Drive SDK

I'm looking for some clarification on accessing Google docs/Drive SDK via a Service Account.
I have everything set up in the API Console and I can successfully generate an access token via the JWT process and indeed I can issue requests to either drive SDK or the Docs List API to get a listing of documents. However, the document listing is always empty, I was expecting to see all the documents in my Google Drive. I am obviously not understanding fully what a service account gives you. If I upload a document via the Service Account then it does show up correctly, but is not visible in my Google Drive, it's as if the Service Account is a totally separate black box.
The reason I want to use Service Accounts is that I have a service running that needs to upload documents to various clients Google Docs accounts, without them having to go through the OAuth dance as there will be no UI interaction at all. Is this possible with Google docs. I was hoping that they could just send my the client_email and the certificate with the private key and I would be able to upload documents to that account.
Many thanks for your consideration
-Marshall
Not sure whether you need the answer anymore, but I just faced with the same issue, came to this post. Found one solution which works in my case, so sharing with everyone here.
The only integration point towards GoogleDrive in my case is document listing.
When I first created my service account, it didn't work as well (just empty list all the time).
What did I do to fix it:
Go to MyDrive UI https://drive.google.com/#my-drive
Checked all the documents I want to see on my website
In the top menu clicked "More"->"Share..."->"Share..."
In "Add people" section (new window "Sharing settings (N items)") I added service account email (format is "XXXXXX##developer.gserviceaccount.com")
Run document listing once again and got it working.