Pulling Google Apps user creation date - google-apps-script

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.

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.

Integrate Gmail api with Google app maker

I'm creating a google app using app maker. I want to integrate the Gmail API with the application. I went through it's guideline, but couldn't able to find any useful resource for my use case.
According to the guideline, google app script are supporting this, but I don't' know if it is possible to integrate the that it to the Google App Maker application.
Thanks in advance.
Update
I have done a bit of research and found that there's an inbuilt object called GmailApp which could be access via a server script. There are number of functions related to that. What I particularly looking for is to get/read email thread for the given subject and open it in a separate browser window, so the user will be able to interact with it (read the thread, reply..etc.)
I was able to integrate the Gmail API by going to
APP SETTINGS -> Advanced services and click on ADD SERVICE.
From there we could select Gmail API from the available services. As shown in the screen capture below.

Google Apps Script oAuth 2.0

I'm using Google Query and Google Apps Script to create information pages (draw tables, graphics etc) inside Google Drive.
Since yesterday all pages, that I've created, are falling down with this message:
Error in query: ACCESS_DENIED. This spreadsheet is not publicly viewable and requires an OAuth credential.
I understand that Google wants me to use oAuth 2.0 however I'm unsure how to do this since every page is enabled only for registered Google users and of course it requires basic Google authentication.
Does anyone have any ideas on how to include oAuth 2.0 into Script inside Google Drive, which is already using oAuth 2.0 (At least I guess it is)?
There are a number of ways of using OAuth 2.0 within Google Apps Script depending on what you're trying to achieve. See here and here, for examples.
Perhaps you could post your sample code, explaining what you're looking to do and where it is going wrong?
We had this problem couple of days ago. We created an add-on which helped us resolve the following problem. Please go through this link to
create an add-on
Then gapi js was able to communicate with our spreadsheet even when private. Hope it helps.

How do I change the authorization domain using Google Drive?

I have a Google Drive enabled application that I'm trying to get into the Google Apps Marketplace. It was rejected because:
Your request begins : https://www.google.com/accounts/o8/ud?openid
It should look more like :
https://www.google.com/a/DOMAIN_GOES_HERE/o8/ud
I've not been able to get an response from anyone at Google as to what this means.
We based our Drive operations on the Java DrEdit example.
Is it possible, using the Google API Java Client Library, to use the second domain above, if so, how?
Also, even if it can be accessed, does it have access to the file permission settings I need in order to perform the various Drive operations?
The answer is that it's not possible at this time. The variant of OAuth2 used with Google Drive does not permit forcing login to a particular domain.
The Google Apps Marketplace storekeepers should be allowing such applications to be accepted until a workaround is found.

Is there a G Suite/Google Apps API?

I had several questions regarding the usability of a "G Suite/Google Apps API." I would like to integrate some sort of document/spreadsheet/presentation management directly into an application I am building.
This service would have to have the ability to import and export to DOC/XLS/PPT/PDF etc..., so something like Feng Office (if you have ever heard of it), wouldn't suit this need.
For this purpose, I'm looking into such a thing exists. Before I would begin this endeavor, I was wondering:
Do the G Suite/Google Apps productivity tools allow documents/spreadsheets/presentations to be created, read, updated, and deleted all from a third-party application?
Would potential users have to have a Google account in order to use document/spreadsheet/presentation editor?
Could multiple users on my application access files under one Google account, if an account is needed at all?
Last, is it possible to skip a Google account, and let Google docs directly access and save documents on my local server?
Sorry for the crash list of questions, but if there is anyone who could help with these, it would be much appreciated.
spryno724
Yes.
Not necessarily, you can have your backend script sign in as you, or even better, an admin account set-up specifically for your app.
Yes, see #2.
I don't think so.
(Feb 2017) The executive summary is that you can do what you envision, either by using G Suite (formerly Google Apps) APIs or Google Apps Script. TL;DR below in response to your "mini-questions".
Yes; you can do it with...
Individual app REST APIs, i.e., Sheets API, Slides API, etc., or just the Google Drive API.
Keep in mind that the Drive API is used for file-oriented functionality (create, delete, import/export, etc.) while the individual APIs are for document-oriented functionality (editing, formatting, etc.)
To learn about using the REST APIs, see the first few videos in this playlist, specifically videos 2, 3, and 4 to start with
An alternative that's more like using "services" vs. APIs but that can also programmatically CRUD G Suite documents is Google Apps Script, server-side JavaScript apps that are hosted at and run in Google's cloud. If interested, I created an Apps Script intro video for you.
FYI, videos 5, 8, 22, and 24 from the playlist above are for Apps Script if you want to pursue that
Note that neither Google Docs nor Google Forms currently have REST APIs, but you can programmatically access them from Apps Script.
Yes, users need to have a Google account but they don't have to create a Gmail address. See this page on creating Google accounts without Gmail. (If they do want to create a Gmail address, then they can use this page instead.)
Yes, you would use the Drive API to set the sharing permissions with your users. See this page on Permissions and this one on Sharing for more info.
Not really; you need at least one Google account in order to access Google Drive where the files would be stored. You can, however, manage the files on your own, then import to Drive and export from Drive to allow your users to edit on your servers then push them back to Drive. For more info on import/export formats/MIMEtypes, see my answer to another SO question.