Compare commits

...

15 Commits

Author SHA1 Message Date
Ross Scroggs
1c8a3a3c57 Added option addcsvdata <FieldName> <String> to gam <UserTypeEntity> print messages 2025-11-24 10:30:18 -08:00
Ross Scroggs
4fc4a21909 Update Users-Gmail-Messages-Threads.md 2025-11-24 09:41:11 -08:00
Ross Scroggs
061fead29e Updated gam delete project to handle the following error:
Some checks failed
Build and test GAM / build (false, build, 1, Build Intel Ubuntu Jammy, ubuntu-22.04) (push) Has been cancelled
Build and test GAM / build (false, build, 10, Build x86_64 macOS 15, macos-15-intel) (push) Has been cancelled
Build and test GAM / build (false, build, 11, Build Arm MacOS 26, macos-26) (push) Has been cancelled
Build and test GAM / build (false, build, 12, Build Intel Windows, windows-2025) (push) Has been cancelled
Build and test GAM / build (false, build, 13, Build Arm Windows, windows-11-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 2, Build Intel Ubuntu Noble, ubuntu-24.04) (push) Has been cancelled
Build and test GAM / build (false, build, 3, Build Arm Ubuntu Noble, ubuntu-24.04-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 4, Build Arm Ubuntu Jammy, ubuntu-22.04-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 5, Build Intel StaticX Legacy, ubuntu-22.04, yes) (push) Has been cancelled
Build and test GAM / build (false, build, 6, Build Arm StaticX Legacy, ubuntu-22.04-arm, yes) (push) Has been cancelled
Build and test GAM / build (false, build, 8, Build Arm MacOS 14, macos-14) (push) Has been cancelled
Build and test GAM / build (false, build, 9, Build Arm MacOS 15, macos-15) (push) Has been cancelled
Build and test GAM / build (false, test, 14, Test Python 3.10, ubuntu-24.04, 3.10) (push) Has been cancelled
Build and test GAM / build (false, test, 15, Test Python 3.11, ubuntu-24.04, 3.11) (push) Has been cancelled
Build and test GAM / build (false, test, 16, Test Python 3.12, ubuntu-24.04, 3.12) (push) Has been cancelled
Build and test GAM / build (false, test, 17, Test Python 3.15-dev, ubuntu-24.04, 3.15-dev) (push) Has been cancelled
Build and test GAM / build (true, test, 18, Test Python 3.14 freethread, ubuntu-24.04, 3.14) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Check for Google Root CA Updates / check-certs (push) Has been cancelled
Push wiki / pushwiki (push) Has been cancelled
Build and test GAM / merge (push) Has been cancelled
Build and test GAM / publish (push) Has been cancelled
```
ERROR: 400: failedPrecondition - Project not active
```
2025-11-21 16:25:52 -08:00
Ross Scroggs
36887ba658 Updated gam delete project to handle the following error:
```
ERROR: 400: failedPrecondition - Project not active
```
2025-11-21 16:25:31 -08:00
Ross Scroggs
cecd9dc7ae Update Authorization.md 2025-11-21 16:15:52 -08:00
Ross Scroggs
4a952cbd16 Update gam.cfg.md
Some checks failed
Push wiki / pushwiki (push) Has been cancelled
Build and test GAM / build (false, build, 1, Build Intel Ubuntu Jammy, ubuntu-22.04) (push) Has been cancelled
Build and test GAM / build (false, build, 10, Build x86_64 macOS 15, macos-15-intel) (push) Has been cancelled
Build and test GAM / build (false, build, 11, Build Arm MacOS 26, macos-26) (push) Has been cancelled
Build and test GAM / build (false, build, 12, Build Intel Windows, windows-2025) (push) Has been cancelled
Build and test GAM / build (false, build, 13, Build Arm Windows, windows-11-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 2, Build Intel Ubuntu Noble, ubuntu-24.04) (push) Has been cancelled
Build and test GAM / build (false, build, 3, Build Arm Ubuntu Noble, ubuntu-24.04-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 4, Build Arm Ubuntu Jammy, ubuntu-22.04-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 5, Build Intel StaticX Legacy, ubuntu-22.04, yes) (push) Has been cancelled
Build and test GAM / build (false, build, 6, Build Arm StaticX Legacy, ubuntu-22.04-arm, yes) (push) Has been cancelled
Build and test GAM / build (false, build, 8, Build Arm MacOS 14, macos-14) (push) Has been cancelled
Build and test GAM / build (false, build, 9, Build Arm MacOS 15, macos-15) (push) Has been cancelled
Build and test GAM / build (false, test, 14, Test Python 3.10, ubuntu-24.04, 3.10) (push) Has been cancelled
Build and test GAM / build (false, test, 15, Test Python 3.11, ubuntu-24.04, 3.11) (push) Has been cancelled
Build and test GAM / build (false, test, 16, Test Python 3.12, ubuntu-24.04, 3.12) (push) Has been cancelled
Build and test GAM / build (false, test, 17, Test Python 3.15-dev, ubuntu-24.04, 3.15-dev) (push) Has been cancelled
Build and test GAM / build (true, test, 18, Test Python 3.14 freethread, ubuntu-24.04, 3.14) (push) Has been cancelled
Build and test GAM / merge (push) Has been cancelled
Build and test GAM / publish (push) Has been cancelled
Check for Google Root CA Updates / check-certs (push) Has been cancelled
2025-11-20 08:33:04 -08:00
Ross Scroggs
624ed5f57c Update Users-Drive-Permissions.md
Some checks failed
Push wiki / pushwiki (push) Has been cancelled
Build and test GAM / build (false, build, 1, Build Intel Ubuntu Jammy, ubuntu-22.04) (push) Has been cancelled
Build and test GAM / build (false, build, 10, Build x86_64 macOS 15, macos-15-intel) (push) Has been cancelled
Build and test GAM / build (false, build, 11, Build Arm MacOS 26, macos-26) (push) Has been cancelled
Build and test GAM / build (false, build, 12, Build Intel Windows, windows-2025) (push) Has been cancelled
Build and test GAM / build (false, build, 13, Build Arm Windows, windows-11-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 2, Build Intel Ubuntu Noble, ubuntu-24.04) (push) Has been cancelled
Build and test GAM / build (false, build, 3, Build Arm Ubuntu Noble, ubuntu-24.04-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 4, Build Arm Ubuntu Jammy, ubuntu-22.04-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 5, Build Intel StaticX Legacy, ubuntu-22.04, yes) (push) Has been cancelled
Build and test GAM / build (false, build, 6, Build Arm StaticX Legacy, ubuntu-22.04-arm, yes) (push) Has been cancelled
Build and test GAM / build (false, build, 8, Build Arm MacOS 14, macos-14) (push) Has been cancelled
Build and test GAM / build (false, build, 9, Build Arm MacOS 15, macos-15) (push) Has been cancelled
Build and test GAM / build (false, test, 14, Test Python 3.10, ubuntu-24.04, 3.10) (push) Has been cancelled
Build and test GAM / build (false, test, 15, Test Python 3.11, ubuntu-24.04, 3.11) (push) Has been cancelled
Build and test GAM / build (false, test, 16, Test Python 3.12, ubuntu-24.04, 3.12) (push) Has been cancelled
Build and test GAM / build (false, test, 17, Test Python 3.15-dev, ubuntu-24.04, 3.15-dev) (push) Has been cancelled
Build and test GAM / build (true, test, 18, Test Python 3.14 freethread, ubuntu-24.04, 3.14) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Check for Google Root CA Updates / check-certs (push) Has been cancelled
Build and test GAM / merge (push) Has been cancelled
Build and test GAM / publish (push) Has been cancelled
2025-11-19 18:14:37 -08:00
Ross Scroggs
0925ff8bd4 Update Users-Drive-Permissions.md 2025-11-19 18:12:51 -08:00
Ross Scroggs
2aecfc24dc Removed inheritance from gam create|update|info|print org 2025-11-19 17:49:34 -08:00
Ross Scroggs
d5d17676cc Removed inheritance from gam create|update|info|print org 2025-11-19 17:09:13 -08:00
Ross Scroggs
aa62ac4f3c Update Organizational-Units.md 2025-11-19 16:47:14 -08:00
Ross Scroggs
e555e5440d Added a command gam print course-counts
Some checks failed
Build and test GAM / build (false, build, 1, Build Intel Ubuntu Jammy, ubuntu-22.04) (push) Has been cancelled
Build and test GAM / build (false, build, 10, Build x86_64 macOS 15, macos-15-intel) (push) Has been cancelled
Build and test GAM / build (false, build, 11, Build Arm MacOS 26, macos-26) (push) Has been cancelled
Build and test GAM / build (false, build, 12, Build Intel Windows, windows-2025) (push) Has been cancelled
Build and test GAM / build (false, build, 13, Build Arm Windows, windows-11-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 2, Build Intel Ubuntu Noble, ubuntu-24.04) (push) Has been cancelled
Build and test GAM / build (false, build, 3, Build Arm Ubuntu Noble, ubuntu-24.04-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 4, Build Arm Ubuntu Jammy, ubuntu-22.04-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 5, Build Intel StaticX Legacy, ubuntu-22.04, yes) (push) Has been cancelled
Build and test GAM / build (false, build, 6, Build Arm StaticX Legacy, ubuntu-22.04-arm, yes) (push) Has been cancelled
Build and test GAM / build (false, build, 8, Build Arm MacOS 14, macos-14) (push) Has been cancelled
Build and test GAM / build (false, build, 9, Build Arm MacOS 15, macos-15) (push) Has been cancelled
Build and test GAM / build (false, test, 14, Test Python 3.10, ubuntu-24.04, 3.10) (push) Has been cancelled
Build and test GAM / build (false, test, 15, Test Python 3.11, ubuntu-24.04, 3.11) (push) Has been cancelled
Build and test GAM / build (false, test, 16, Test Python 3.12, ubuntu-24.04, 3.12) (push) Has been cancelled
Build and test GAM / build (false, test, 17, Test Python 3.15-dev, ubuntu-24.04, 3.15-dev) (push) Has been cancelled
Build and test GAM / build (true, test, 18, Test Python 3.14 freethread, ubuntu-24.04, 3.14) (push) Has been cancelled
Build and test GAM / merge (push) Has been cancelled
Build and test GAM / publish (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Check for Google Root CA Updates / check-certs (push) Has been cancelled
Push wiki / pushwiki (push) Has been cancelled
2025-11-19 13:52:54 -08:00
Ross Scroggs
122f5c3c0d Added a command gam print course-counts 2025-11-19 13:23:26 -08:00
Ross Scroggs
4423a1ed0b Added a command gam print course-counts 2025-11-19 12:50:05 -08:00
Ross Scroggs
e0f8789a8a Fixed bug in gam print cigroups ... descriptionmatchpattern [not] <REMatchPattern> 2025-11-19 09:25:02 -08:00
13 changed files with 187 additions and 80 deletions

View File

@@ -3268,6 +3268,11 @@ gam print course-participants [todrive <ToDriveAttribute>*]
[formatjson [quotechar <Character>]]
[showitemcountonly]
gam print course-counts students|teachers [todrive <ToDriveAttribute>*]
(course|class <CourseEntity>)*|([teacher <UserItem>] [student <UserItem>] [states <CourseStateList>])
[mincount <Integer>]
[formatjson [quotechar <Character>]]
<CourseAnnouncementFieldName> ::=
alternatelink|
assigneemode|
@@ -4446,22 +4451,21 @@ gam print mobile [todrive <ToDriveAttribute>*]
<OrgUnitFieldName> ::=
description|
id|orgunitid|
inherit|blockinheritance|
name|
parentid|parentorgunitid|
parent|parentorgunitpath|
path|orgunitpath
<OrgUnitFieldNameList> ::= "<OrgUnitFieldName>(,<OrgUnitFieldName>)*"
gam create|add org|ou <OrgUnitPath> [description <String>] [parent <OrgUnitItem>] [inherit|(blockinheritance False)] [buildpath]
gam update org|ou <OrgUnitItem> [name <String>] [description <String>] [parent <OrgUnitItem>] [inherit|(blockinheritance False)]
gam create|add org|ou <OrgUnitPath> [description <String>] [parent <OrgUnitItem>] [buildpath]
gam update org|ou <OrgUnitItem> [name <String>] [description <String>] [parent <OrgUnitItem>]
gam update org|ou <OrgUnitItem> add|move <CrOSTypeEntity> [quickcrosmove [<Boolean>]]
gam update org|ou <OrgUnitItem> add|move <UserTypeEntity>
gam update org|ou <OrgUnitItem> sync <CrOSTypeEntity> [removetoou <OrgUnitItem>] [quickcrosmove [<Boolean>]]
gam update org|ou <OrgUnitItem> sync <UserTypeEntity> [removetoou <OrgUnitItem>]
gam delete org|ou <OrgUnitItem>
gam update orgs|ous <OrgUnitEntity> [name <String>] [description <String>] [parent <OrgUnitItem>] [inherit|(blockinheritance False)]
gam update orgs|ous <OrgUnitEntity> [name <String>] [description <String>] [parent <OrgUnitItem>]
gam update orgs|ous <OrgUnitEntity> add|move <CrOSTypeEntity> [quickcrosmove [<Boolean>]]
gam update orgs|ous <OrgUnitEntity> add|move <UserTypeEntity>
gam update orgs|ous <OrgUnitEntity> sync <CrOSTypeEntity> [removetoou <OrgUnitItem>] [quickcrosmove [<Boolean>]]
@@ -7873,9 +7877,9 @@ gam <UserTypeEntity> show messages|threads
[labelids <LabelIDList>]
[quick|notquick] [max_to_show <Number>] [includespamtrash])|(ids <MessageIDEntity>)
[labelmatchpattern <REMatchPattern>] [sendermatchpattern <REMatchPattern>]
[countsonly|positivecountsonly] [useronly]
[countsonly|positivecountsonly]
[headers all|<SMTPHeaderList>] [dateheaderformat iso|rfc2822|<String>] [dateheaderconverttimezone [<Boolean>]]
[showlabels] [delimiter <Character>] [showbody] [showhtml] [showdate] [showsize] [showsnippet]
[showlabels] [useronly] [delimiter <Character>] [showbody] [showhtml] [showdate] [showsize] [showsnippet]
[maxmessagesperthread <Number>]
[[attachmentnamepattern <REMatchPattern>]
[showattachments [noshowtextplain]]
@@ -7886,9 +7890,9 @@ gam <UserTypeEntity> print messages|threads [todrive <ToDriveAttribute>*]
[labelids <LabelIDList>]
[quick|notquick] [max_to_print <Number>] [includespamtrash])|(ids <MessageIDEntity>)
[labelmatchpattern <REMatchPattern>] [sendermatchpattern <REMatchPattern>]
[countsonly|positivecountsonly] [useronly]
[countsonly|positivecountsonly]
[headers all|<SMTPHeaderList>] [dateheaderformat iso|rfc2822|<String> [dateheaderconverttimezone [<Boolean>]]]
[showlabels] [delimiter <Character>] [showbody] [showhtml] [showdate] [showsize] [showsnippet]
[showlabels] [useronly] [delimiter <Character>] [showbody] [showhtml] [showdate] [showsize] [showsnippet]
[maxmessagesperthread <Number>]
[convertcrnl] [delimiter <Character>]
[[attachmentnamepattern <REMatchPattern>]

View File

@@ -1,3 +1,25 @@
7.28.13
Added option `addcsvdata <FieldName> <String>` to `gam <UserTypeEntity> print messages`
that adds additional columns of data to the CSV file output.
7.28.12
Updated `gam delete project` to handle the following error:
```
ERROR: 400: failedPrecondition - Project not active
```
7.28.11
Removed all options/fields referencing inheritance from `gam create|update|info|print org` as this option/field is deprecated.
7.28.10
Added a command `gam print course-counts` that dsplays the count of the number of courses in which a teacher or student is a participant.
* See: https://github.com/GAM-team/GAM/wiki/Classroom-Membership#display-course-counts-for-teachers-students
7.28.09
Fixed bug in `gam print cigroups ... descriptionmatchpattern [not] <REMatchPattern>` that caused a trap.

View File

@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
"""
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
__version__ = '7.28.09'
__version__ = '7.28.13'
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
#pylint: disable=wrong-import-position
@@ -12068,10 +12068,10 @@ def doDeleteProject():
projectId = project['projectId']
try:
callGAPI(crm.projects(), 'delete',
throwReasons=[GAPI.FORBIDDEN, GAPI.PERMISSION_DENIED],
throwReasons=[GAPI.FORBIDDEN, GAPI.PERMISSION_DENIED, GAPI.FAILED_PRECONDITION],
name=project['name'])
entityActionPerformed([Ent.PROJECT, projectId])
except (GAPI.forbidden, GAPI.permissionDenied) as e:
except (GAPI.forbidden, GAPI.permissionDenied, GAPI.failedPrecondition) as e:
entityActionFailedWarning([Ent.PROJECT, projectId], str(e))
Ind.Decrement()
@@ -17603,23 +17603,7 @@ def doShowTransferApps():
Ind.Decrement()
Ind.Decrement()
def _getOrgInheritance(myarg, body):
if myarg == 'noinherit':
Cmd.Backup()
deprecatedArgumentExit(myarg)
elif myarg == 'inherit':
body['blockInheritance'] = False
elif myarg in {'blockinheritance', 'inheritanceblocked'}:
location = Cmd.Location()-1
if getBoolean():
Cmd.SetLocation(location)
deprecatedArgumentExit(myarg)
body['blockInheritance'] = False
else:
return False
return True
# gam create org|ou <String> [description <String>] [parent <OrgUnitItem>] [inherit|(blockinheritance False)] [buildpath]
# gam create org|ou <String> [description <String>] [parent <OrgUnitItem>] [buildpath]
def doCreateOrg():
def _createOrg(body, parentPath, fullPath):
@@ -17648,8 +17632,6 @@ def doCreateOrg():
body['description'] = getStringWithCRsNLs()
elif myarg == 'parent':
parent = getOrgUnitItem()
elif _getOrgInheritance(myarg, body):
pass
elif myarg == 'buildpath':
buildPath = True
else:
@@ -17933,8 +17915,6 @@ def _doUpdateOrgs(entityList):
body['parentOrgUnitId'] = parent
else:
body['parentOrgUnitPath'] = parent
elif _getOrgInheritance(myarg, body):
pass
else:
unknownArgumentExit()
i = 0
@@ -17956,7 +17936,7 @@ def _doUpdateOrgs(entityList):
except (GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired):
checkEntityAFDNEorAccessErrorExit(cd, Ent.ORGANIZATIONAL_UNIT, orgUnitPath)
# gam update orgs|ous <OrgUnitEntity> [name <String>] [description <String>] [parent <OrgUnitItem>] [inherit|(blockinheritance False)]
# gam update orgs|ous <OrgUnitEntity> [name <String>] [description <String>] [parent <OrgUnitItem>]
# gam update orgs|ous <OrgUnitEntity> add|move <CrosTypeEntity> [quickcrosmove [<Boolean>]]
# gam update orgs|ous <OrgUnitEntity> add|move <UserTypeEntity>
# gam update orgs|ous <OrgUnitEntity> sync <CrosTypeEntity> [removetoou <OrgUnitItem>] [quickcrosmove [<Boolean>]]
@@ -17964,7 +17944,7 @@ def _doUpdateOrgs(entityList):
def doUpdateOrgs():
_doUpdateOrgs(getEntityList(Cmd.OB_ORGUNIT_ENTITY, shlexSplit=True))
# gam update org|ou <OrgUnitItem> [name <String>] [description <String>] [parent <OrgUnitItem>] [inherit|(blockinheritance False)]
# gam update org|ou <OrgUnitItem> [name <String>] [description <String>] [parent <OrgUnitItem>]
# gam update org|ou <OrgUnitItem> add|move <CrosTypeEntity> [quickcrosmove [<Boolean>]]
# gam update org|ou <OrgUnitItem> add|move <UserTypeEntity>
# gam update org|ou <OrgUnitItem> sync <CrosTypeEntity> [removetoou <OrgUnitItem>] [quickcrosmove [<Boolean>]]
@@ -18096,9 +18076,6 @@ def doInfoOrgs():
_doInfoOrgs(getEntityList(Cmd.OB_ORGUNIT_ENTITY, shlexSplit=True))
ORG_ARGUMENT_TO_FIELD_MAP = {
'blockinheritance': 'blockInheritance',
'inheritanceblocked': 'blockInheritance',
'inherit': 'blockInheritance',
'description': 'description',
'id': 'orgUnitId',
'name': 'name',
@@ -50290,6 +50267,64 @@ def doPrintCourseParticipants():
csvPF.SetSortTitles(COURSE_PARTICIPANTS_SORT_TITLES)
csvPF.writeCSVfile('Course Participants')
COURSE_COUNTS_MEMBER_ARGUMENTS = ['students', 'teachers']
COURSE_COUNTS_KEY_TITLE = {'students': 'Student', 'teachers': 'Teacher'}
# gam print course-counts students|teachers [todrive <ToDriveAttribute>*]
# (course|class <CourseEntity>)*|([teacher <UserItem>] [student <UserItem>] [states <CourseStateList>])
# [mincount <Integer>]
# [formatjson [quotechar <Character>]]
def doPrintCourseCounts():
croom = buildGAPIObject(API.CLASSROOM)
courseSelectionParameters = _initCourseSelectionParameters()
courseShowProperties = _initCourseShowProperties()
courseShowProperties['members'] = getChoice(COURSE_COUNTS_MEMBER_ARGUMENTS)
keyTitle = COURSE_COUNTS_KEY_TITLE[courseShowProperties['members']]
csvPF = CSVPrintFile([keyTitle, 'CourseCount'])
FJQC = FormatJSONQuoteChar(csvPF)
minCount = 0
useOwnerAccess = GC.Values[GC.USE_COURSE_OWNER_ACCESS]
while Cmd.ArgumentsRemaining():
myarg = getArgument()
if myarg == 'todrive':
csvPF.GetTodriveParameters()
elif _getCourseSelectionParameters(myarg, courseSelectionParameters):
pass
elif myarg == 'mincount':
minCount = getInteger(minVal=0)
else:
FJQC.GetFormatJSONQuoteChar(myarg, False)
coursesInfo = _getCoursesInfo(croom, courseSelectionParameters, courseShowProperties, useOwnerAccess)
if not coursesInfo:
coursesInfo = []
teachersFields = 'nextPageToken,teachers(profile(emailAddress))'
studentsFields = 'nextPageToken,students(profile(emailAddress))'
courseCounts = {}
count = len(coursesInfo)
i = 0
for course in coursesInfo:
i += 1
courseId = course['id']
ocroom = _getCourseOwnerSA(croom, course, useOwnerAccess)
if not ocroom:
continue
_, teachers, students = _getCourseAliasesMembers(croom, ocroom, courseId, courseShowProperties, teachersFields, studentsFields, True, i, count)
members = teachers if courseShowProperties['members'] == 'teachers' else students
for member in members:
memberKey = member['profile'].get('emailAddress', '')
courseCounts.setdefault(memberKey, 0)
courseCounts[memberKey] += 1
if not FJQC.formatJSON:
for key, count in sorted(courseCounts.items()):
if count >= minCount:
csvPF.WriteRow({keyTitle: key, 'CourseCount': count})
else:
csvPF.SetJSONTitles(['JSON'])
for key, count in sorted(courseCounts.items()):
if count >= minCount:
csvPF.WriteRow({'JSON': {keyTitle: key, 'CourseCount': count}})
csvPF.writeCSVfile(f'{keyTitle} Course Counts')
def _batchAddItemsToCourse(croom, courseId, i, count, addItems, addType):
def _addIdToResponse(response, riItem):
if addType == Ent.COURSE_ANNOUNCEMENT:
@@ -73555,6 +73590,8 @@ def printShowMessagesThreads(users, entityType):
row[f'Attachments{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{i}{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}mimeType'] = attachment[1]
row[f'Attachments{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{i}{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}size'] = attachment[2]
row[f'Attachments{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{i}{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}charset'] = attachment[3]
if addCSVData:
row.update(addCSVData)
csvPF.WriteRowTitles(row)
if checkMax:
parameters['messagesProcessed'] += 1
@@ -74043,7 +74080,7 @@ def printShowMessagesThreads(users, entityType):
# [quick|notquick] [max_to_print <Number>] [includespamtrash])|(ids <MessageIDEntity>)
# [labelmatchpattern <REMatchPattern>] [sendermatchpattern <REMatchPattern>]
# [headers all|<SMTPHeaderList>] [dateheaderformat iso|rfc2822|<String>] [dateheaderconverttimezone [<Boolean>]]
# [showlabels] [showbody] [showhtml] [showdate] [showsize] [showsnippet]
# [showlabels] [useronly] [delimiter <Character>] [showbody] [showhtml] [showdate] [showsize] [showsnippet]
# [convertcrnl] [delimiter <Character>]
# [countsonly|positivecountsonly] [useronly]
# [[attachmentnamepattern <REMatchPattern>]
@@ -74055,8 +74092,8 @@ def printShowMessagesThreads(users, entityType):
# [quick|notquick] [max_to_show <Number>] [includespamtrash])|(ids <MessageIDEntity>)
# [labelmatchpattern <REMatchPattern>] [sendermatchpattern <REMatchPattern>]
# [headers all|<SMTPHeaderList>] [dateheaderformat iso|rfc2822|<String>] [dateheaderconverttimezone [<Boolean>]]
# [showlabels] [showbody] [showhtml] [showdate] [showsize] [showsnippet]
# [countsonly|positivecountsonly] [useronly]
# [showlabels] [useronly] [showbody] [showhtml] [showdate] [showsize] [showsnippet]
# [countsonly|positivecountsonly]
# [[attachmentnamepattern <REMatchPattern>]
# [showattachments [noshowtextplain]]
# [saveattachments [targetfolder <FilePath>] [overwrite [<Boolean>]]]
@@ -78802,6 +78839,7 @@ MAIN_COMMANDS_WITH_OBJECTS = {
Cmd.ARG_COURSE: doPrintCourses,
Cmd.ARG_COURSES: doPrintCourses,
Cmd.ARG_COURSEANNOUNCEMENTS: doPrintCourseAnnouncements,
Cmd.ARG_COURSECOUNTS: doPrintCourseCounts,
Cmd.ARG_COURSEMATERIALS: doPrintCourseMaterials,
Cmd.ARG_COURSEPARTICIPANTS: doPrintCourseParticipants,
Cmd.ARG_COURSESTUDENTGROUP: doPrintCourseStudentGroups,
@@ -79128,6 +79166,7 @@ MAIN_COMMANDS_OBJ_ALIASES = {
Cmd.ARG_CLASSIFICATIONLABELPERMISSIONS: Cmd.ARG_DRIVELABELPERMISSION,
Cmd.ARG_CLASS: Cmd.ARG_COURSE,
Cmd.ARG_CLASSES: Cmd.ARG_COURSES,
Cmd.ARG_CLASSCOUNTS: Cmd.ARG_COURSECOUNTS,
Cmd.ARG_CLASSPARTICIPANTS: Cmd.ARG_COURSEPARTICIPANTS,
Cmd.ARG_CLASSROOMINVITATIONS: Cmd.ARG_CLASSROOMINVITATION,
Cmd.ARG_CONTACTS: Cmd.ARG_CONTACT,

View File

@@ -788,6 +788,7 @@ class GamCLArgs():
ARG_CLASSIFICATIONLABELPERMISSIONS = 'classificationlabelpermissions'
ARG_CLASS = 'class'
ARG_CLASSES = 'classes'
ARG_CLASSCOUNTS = 'classcounts'
ARG_CLASSPARTICIPANTS = 'classparticipants'
ARG_CLASSROOMINVITATION = 'classroominvitation'
ARG_CLASSROOMINVITATIONS = 'classroominvitations'
@@ -806,6 +807,7 @@ class GamCLArgs():
ARG_COURSE = 'course'
ARG_COURSES = 'courses'
ARG_COURSEANNOUNCEMENTS = 'courseannouncements'
ARG_COURSECOUNTS = 'coursecounts'
ARG_COURSEMATERIALS = 'coursematerials'
ARG_COURSEPARTICIPANTS = 'courseparticipants'
ARG_COURSESTUDENTGROUP = 'coursestudentgroup'

View File

@@ -394,9 +394,9 @@ gam show projects [[admin] <EmailAddress>] [all|<ProjectIDEntity>]
* `<EmailAddress>` - A Google Workspace admin/GCP project manager; if omitted, you will be prompted for the address
Use these options to select projects.
* `all` - All projects accessible by the administrator; this is the default
* `all` - All projects accessible by the administrator
* `current` - The project referenced in `client_secrets.json`
* `gam` - Projects accessible by the administrator that were created by Gam, i.e, their project ID begins with `gam-project-`
* `gam` - Projects accessible by the administrator that were created by Gam, i.e, their project ID begins with `gam-project-`; this is the default
* `<ProjectID>` - A Google API project ID
* `filter <String>` - A filter to select projects accessible by the administrator; see the API documentation
* `states all|active|deleterequested` - Limit display to projects based on state; the default is `active`
@@ -412,9 +412,9 @@ gam print projects [[admin] <EmailAddress>] [all|<ProjectIDEntity>] [todrive <To
* `<EmailAddress>` - A Google Workspace admin/GCP project manager; if omitted, you will be prompted for the address
Use these options to select projects.
* `all` - All projects accessible by the administrator; this is the default
* `all` - All projects accessible by the administrator
* `current` - The project referenced in `client_secrets.json`
* `gam` - Projects accessible by the administrator that were created by Gam, i.e, their project ID begins with `gam-project-`
* `gam` - Projects accessible by the administrator that were created by Gam, i.e, their project ID begins with `gam-project-`; this is the default
* `<ProjectID>` - A Google API project ID
* `filter <String>` - A filter to select projects accessible by the administrator; see the API documentation
* `states all|active|deleterequested` - Limit display to projects based on state; the default is `active`

View File

@@ -172,20 +172,42 @@ for /f "delims=" %a in ('gam print course-participants teacher asmith states act
## Display course counts for teachers-students
You can get a count of the number of courses in which a teacher or student is a participant.
```
gam config csv_output_header_filter profile.emailAddress redirect csv ./Teachers.csv print course-participants states active show teachers
gam config csv_output_header_filter profile.emailAddress redirect csv ./Students.csv print course-participants states active show students
gam print course-counts students|teachers [todrive <ToDriveAttribute>*]
(course|class <CourseEntity>)*|([teacher <UserItem>] [student <UserItem>] [states <CourseStateList>])
[mincount <Integer>]
[formatjson [quotechar <Character>]]
```
By default, the `print course-counts` command displays participant counts about all courses.
Download the following script: https://github.com/taers232c/GAM-Scripts3/blob/master/CountKeyValues.py
To get participant counts for a specific set of courses, use the following option; it can be repeated to select multiple courses.
* `(course|class <CourseID>)*` - Display courses with the specified `<CourseID>`.
Edit the script.
```
KEY_FIELD = 'profile.emailAddress' # Set to a column header in KeyValues.csv
MIN_KEY_COUNT = 0 # 0 - Show all counts; N - Show counts >= N
```
To get participant counts for courses based on their having a particular participant, use the following options. Both options can be specified.
* `teacher <UserItem>` - Display courses with the specified teacher.
* `student <UserItem>` - Display courses with the specified student.
Run the script.
To get participant counts for courses based on their state, use the following option. This option can be combined with the `teacher` and `student` options.
By default, all course states are selected.
* `states <CourseStateList>` - Display courses with any of the specified states.
By default, all count values are displayed, use `mincount <Integer>` to limit the display to those counts
greater that or equal to the specified `<Integer>`.
By default, Gam displays the counts as columns of fields; the following option causes the output to be in JSON format,
* `formatjson` - Display the fields in JSON format.
By default, when writing CSV files, Gam uses a quote character of double quote `"`. The quote character is used to enclose columns that contain
the quote character itself, the column delimiter (comma by default) and new-line characters. Any quote characters within the column are doubled.
When using the `formatjson` option, double quotes are used extensively in the data resulting in hard to read/process output.
The `quotechar <Character>` option allows you to choose an alternate quote character, single quote for instance, that makes for readable/processable output.
`quotechar` defaults to `gam.cfg/csv_output_quote_char`. When uploading CSV files to Google, double quote `"` should be used.
### Example
For teachers in all active courses, print the number of classes for which they are a participant.
```
python ./CountKeyValues.py Teachers.csv TeacherCounts.csv
python ./CountKeyValues.py Students.csv StudentCounts.csv
gam print coursecounts teachers states active
```
For teachers in all active courses, print the number of classes (if it is >= 5) for which they are a participant.
```
gam print coursecounts teachers states active mincount 5
```

View File

@@ -10,6 +10,27 @@ Add the `-s` option to the end of the above commands to suppress creating the `g
See [Downloads-Installs-GAM7](https://github.com/GAM-team/GAM/wiki/Downloads-Installs) for Windows or other options, including manual installation
### 7.28.12
Updated `gam delete project` to handle the following error:
```
ERROR: 400: failedPrecondition - Project not active
```
### 7.28.11
Removed all options/fields referencing inheritance from `gam create|update|info|print org` as this option/field is deprecated.
### 7.28.10
Added a command `gam print course-counts` that dsplays the count of the number of courses in which a teacher or student is a participant.
* See: https://github.com/GAM-team/GAM/wiki/Classroom-Membership#display-course-counts-for-teachers-students
### 7.28.09
Fixed bug in `gam print cigroups ... descriptionmatchpattern [not] <REMatchPattern>` that caused a trap.
### 7.28.08
Updated `gam <UserTypeEntity> print|show chatmessages` to cache the sender UID to email address

View File

@@ -252,7 +252,7 @@ writes the credentials into the file oauth2.txt.
admin@server:/Users/admin$ rm -f /Users/admin/GAMConfig/oauth2.txt
admin@server:/Users/admin$ gam version
WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found
GAM 7.28.08 - https://github.com/GAM-team/GAM - pyinstaller
GAM 7.28.12 - https://github.com/GAM-team/GAM - pyinstaller
GAM Team <google-apps-manager@googlegroups.com>
Python 3.14.0 64-bit final
macOS Tahoe 26.1 x86_64
@@ -990,7 +990,7 @@ writes the credentials into the file oauth2.txt.
C:\>del C:\GAMConfig\oauth2.txt
C:\>gam version
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
GAM 7.28.08 - https://github.com/GAM-team/GAM - pythonsource
GAM 7.28.12 - https://github.com/GAM-team/GAM - pythonsource
GAM Team <google-apps-manager@googlegroups.com>
Python 3.14.0 64-bit final
Windows 11 10.0.26200 AMD64

View File

@@ -32,7 +32,6 @@
<OrgUnitFieldName> ::=
description|
id|orgunitid|
inherit|blockinheritance|
name|
parentid|parentorgunitid|
parent|parentorgunitpath|
@@ -73,18 +72,15 @@ For quoting rules, see: [List Quoting Rules](Command-Line-Parsing)
Create, update and delete organization units.
```
gam create org|ou <OrgUnitPath> [description <String>]
[parent <OrgUnitItem>] [inherit|(blockinheritance False)]
[parent <OrgUnitItem>]
[buildpath]
gam update org|ou <OrgUnitPath> [name <String>] [description <String>]
[parent <OrgUnitItem>] [inherit|(blockinheritance False)]
[parent <OrgUnitItem>]
gam delete org|ou <OrgUnitPath>
gam update orgs|ous <OrgUnitEntity> [name <String>] [description <String>]
[parent <OrgUnitItem>] [inherit|(blockinheritance False)]
[parent <OrgUnitItem>]
gam delete orgs|ous <OrgUnitEntity>
```
Inheritance specifies whether sub-OUs of the specified OU inherit its settings.
* `inherit|blockinheritance false` - Sub-OUs inherit settings from the specified OU; this is the default
## Add users to an organizational unit
When adding users to an OU, Gam uses a batch method to speed up processing.

View File

@@ -234,7 +234,6 @@ The option `updatesheetprotectedranges` only applies to items in `<DriveFileEnti
* ACLs with role reader or commenter will be removed from existing protected ranges
* ACLs with role writer or higher will be added to existing protected ranges
`
`enforceexpansiveaccess` defaults to the value of `gam.cfg/enforce_expansive_access` that controls
the ability to update inherited ACLs.
* False - Inherited ACLs can be updated
@@ -261,7 +260,7 @@ The option `updatesheetprotectedranges` only applies to items in `<DriveFileEnti
* ACLs with any role will be removed from existing protected ranges
`enforceexpansiveaccess` defaults to the value of `gam.cfg/enforce_expansive_access` that controls
the ability to delete delete inherited ACLs.
the ability to delete inherited ACLs.
* False - Inherited ACLs can be deleted
* True = Inherited ACLs can not be deleted
@@ -308,7 +307,7 @@ gam <UserTypeEntity> delete permissions <DriveFileEntity> <DriveFilePermissionID
[enforceexpansiveaccess [<Boolean>]]
```
`enforceexpansiveaccess` defaults to the value of `gam.cfg/enforce_expansive_access` that controls
the ability to delete delete inherited ACLs.
the ability to delete inherited ACLs.
* False - Inherited ACLs can be deleted
* True = Inherited ACLs can not be deleted

View File

@@ -589,9 +589,9 @@ gam <UserTypeEntity> show messages|threads
[labelids <LabelIDList>]
[quick|notquick] [max_to_show <Number>] [includespamtrash])|(ids <MessageIDEntity>)
[labelmatchpattern <REMatchPattern>] [sendermatchpattern <REMatchPattern>]
[countsonly|positivecountsonly] [useronly]
[countsonly|positivecountsonly]
[headers all|<SMTPHeaderList>] [dateheaderformat iso|rfc2822|<String>] [dateheaderconverttimezone [<Boolean>]]
[showlabels] [delimiter <Character>] [showbody] [showhtml] [showdate] [showsize] [showsnippet]
[showlabels] [useronly] [delimiter <Character>] [showbody] [showhtml] [showdate] [showsize] [showsnippet]
[maxmessagesperthread <Number>]
[showattachments [attachmentnamepattern <REMatchPattern>>] [noshowtextplain]]
[saveattachments [attachmentnamepattern <REMatchPattern>>]]
@@ -601,12 +601,13 @@ gam <UserTypeEntity> print messages|threads [todrive <ToDriveAttribute>*]
[labelids <LabelIDList>]
[quick|notquick] [max_to_print <Number>] [includespamtrash])|(ids <MessageIDEntity>)
[labelmatchpattern <REMatchPattern>] [sendermatchpattern <REMatchPattern>]
[countsonly|positivecountsonly] [useronly]
[countsonly|positivecountsonly]
[headers all|<SMTPHeaderList>] [dateheaderformat iso|rfc2822|<String>] [dateheaderconverttimezone [<Boolean>]]
[showlabels] [delimiter <Character>] [showbody] [showhtml] [showdate] [showsize] [showsnippet]
[showlabels] [useronly] [delimiter <Character>] [showbody] [showhtml] [showdate] [showsize] [showsnippet]
[maxmessagesperthread <Number>]
[showattachments [attachmentnamepattern <REMatchPattern>>]]
[convertcrnl]
(addcsvdata <FieldName> <String>)*
```
## Display all messages
By default, Gam displays all messages.
@@ -692,6 +693,7 @@ The `dateheaderconverttimezone [<Boolean>]>` option converts `<SMTPDateHeader>`
## Print only options
These options are valid with `print`.
* `convertcrnl` - In the message body, convert carriage returns to `\r` and newlines to `\n`; the default value is `csv_output_convert_cr_nl` from `gam.cfg`.
* `addcsvdata <FieldName> <String>` - Add additional columns of data from the command line to the output
By default, message attachment information is not displayed.
* `showattachments` - Display attachment filename, MIME type and size

View File

@@ -3,7 +3,7 @@
Print the current version of Gam with details
```
gam version
GAM 7.28.08 - https://github.com/GAM-team/GAM - pyinstaller
GAM 7.28.12 - https://github.com/GAM-team/GAM - pyinstaller
GAM Team <google-apps-manager@googlegroups.com>
Python 3.14.0 64-bit final
macOS Tahoe 26.1 x86_64
@@ -15,7 +15,7 @@ Time: 2023-06-02T21:10:00-07:00
Print the current version of Gam with details and time offset information
```
gam version timeoffset
GAM 7.28.08 - https://github.com/GAM-team/GAM - pyinstaller
GAM 7.28.12 - https://github.com/GAM-team/GAM - pyinstaller
GAM Team <google-apps-manager@googlegroups.com>
Python 3.14.0 64-bit final
macOS Tahoe 26.1 x86_64
@@ -27,7 +27,7 @@ Your system time differs from www.googleapis.com by less than 1 second
Print the current version of Gam with extended details and SSL information
```
gam version extended
GAM 7.28.08 - https://github.com/GAM-team/GAM - pyinstaller
GAM 7.28.12 - https://github.com/GAM-team/GAM - pyinstaller
GAM Team <google-apps-manager@googlegroups.com>
Python 3.14.0 64-bit final
macOS Tahoe 26.1 x86_64
@@ -68,7 +68,7 @@ MacOS High Sierra 10.13.6 x86_64
Path: /Users/Admin/bin/gam7
Version Check:
Current: 5.35.08
Latest: 7.28.08
Latest: 7.28.12
echo $?
1
```
@@ -76,7 +76,7 @@ echo $?
Print the current version number without details
```
gam version simple
7.28.08
7.28.12
```
In Linux/MacOS you can do:
```
@@ -86,7 +86,7 @@ echo $VER
Print the current version of Gam and address of this Wiki
```
gam help
GAM 7.28.08 - https://github.com/GAM-team/GAM
GAM 7.28.12 - https://github.com/GAM-team/GAM
GAM Team <google-apps-manager@googlegroups.com>
Python 3.14.0 64-bit final
macOS Tahoe 26.1 x86_64

View File

@@ -565,10 +565,10 @@ timezone
to your local timezone. If you are running GAM on a remote computer or on a
cloud shell, "local" will mean the time at the remote/cloud shell computer,
not your location, Use "+|-hh:mm" to specify the timezone at your location.
Starting with version 7.21.00 you can use a timezone name.
Starting with version 7.21.00 you can use a timezone name; the names are case sensitive.
See: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
Default: utc
Range: utc|z|local|(+|-hh:mm)I<ValidTimezoneName>
Range: utc|z|local|(+|-hh:mm)|<ValidTimezoneName>
tls_max_version
Allowed values: '', tlsv1_2, tlsv1.2, tlsv1_3, tlsv1.3
The maximum TLS version to use in https connections
@@ -622,7 +622,7 @@ todrive_timeformat
Default: '' which selects an ISO format timestamp
Example: %Y-%m-%dT%H:%M:%S will display as 2020-07-06T17:48:54
todrive_timezone
The Spreadsheet settings Timezone value.
The Spreadsheet settings Timezone value; the values are case sensitive.
See: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
Default: ''
todrive_upload_nodata