I want to build a WebApp in Google AppsScript that can pull information for the user accessing it. I want to pull their ChromeOS version (if they use a Chromebook) and their Chrome browser version.
I have searched the Google APIs but haven't seen anything that could do this efficiently/adequately.
I could use Session.getActiveUser().getEmail()
to get the person accessing the script and then do something like:
const response = AdminDirectory.Chromeosdevices.list(customer).chromeosdevices.forEach(device => {
if (device.recentUsers != null)
deviceArr.push([device.deviceId, device.recentUsers[0].email])
}
Pushing the 'recent' user for each device into an array, and then do something like:
deviceArr.forEach(usrDev => {
const user = usrDev[2]
const devInf = AdminDirectory.Chromeosdevices.get(customer,usrDev[0]).osVersion
console.log("USER: "+user+" || ChromeOS Version: "+devInf)
})
And then do a lookup against the active user... but that seems hella clunky for something that feels like it should be pretty straightforward.
Can someone help me or point me in the right direction here?