I've been trying to use the advanced Drive service in Google App Maker. Specifically using the 'q' parameter within the option arguments to the Drive.Teamdrives.list() method.
After many many hours of trying to formulate a query that enabled me to filter on the name, I discovered that I have to set useDomainAdminAccess=true for the query to work. Without that switch I get an error from the query.
My App Maker application is going to run as User instead of Developer and the intended application will query what Teamdrives the user has access to that have a pling(!) in the name.
Can domain users use the useDomainAdminAccess switch or is that only domain admins? Does useDomainAdminAccess give access to all teamdrives in the domain or only teamdrives that the user has access to?
Why is this switch necessary for the q parameter to work?
Should I abandon this way of doing things and research another?
function myFunction() {
list = Drive.Teamdrives.list({q:"name contains '!'",
maxResults:4,
useDomainAdminAccess:true});
Logger.log(list);
}
I should have just used the javascript filter() function to filter my array after the team drives have been scanned.
list = Drive.Teamdrives.list({maxResults:100}).items;
filtered = list.filter(function(obj){
return obj.name.indexOf('Key') === 0;}
);
The code reads only the teamdrives that the user has access to and therefore does not need the useDomainAdminAccess flag.
The array filter returns a new array of only those teamdrives that begin with the word 'Key'.
Answered myself!