-
Notifications
You must be signed in to change notification settings - Fork 10
/
code.gs
36 lines (35 loc) · 1.03 KB
/
code.gs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function doGet(){
return HtmlService.createHtmlOutputFromFile('Index');
}
// Allow users to pull one page of data at a time (automated locally)
function pullSegment(nextPageToken=null){
console.log(nextPageToken)
var emails={};
var page;
var pageToken=nextPageToken
// Comb through drive activity report for all entries with B&S as initiator
// store emails of all users associated with these activities
Logger.log('Requesting Page')
page = AdminDirectory.Activities.list('all', 'drive', {
maxResults: 1000,
filters: 'originating_app_id==645529619299',
pageToken: pageToken
});
var items = page.items;
//pull emails out of the response
if (items) {
Logger.log(`Recieved ${items.length} items`)
for (var i = 0; i < items.length; i++) {
var item = items[i];
if(item.actor.email){
emails[item.actor.email]=1;
}
}
}
pageToken = page.nextPageToken;
// Send current batch back to client with pagetoken to resume.
return {
'emails':emails,
'nextPageToken':pageToken
}
}