Updated gam report gmail start/end time defaults

This commit is contained in:
Ross Scroggs
2025-12-23 14:28:54 -08:00
parent 85e90ec56c
commit 677f683377
2 changed files with 22 additions and 1 deletions

View File

@@ -1,3 +1,13 @@
7.30.04
Updated `gam report gmail` to avoid the following error when incomplete start/end time information is provided.
```
ERROR: Invalid request: Start time and end time should both be provided, and the scan duration should not be greater than 30 days.
```
* No time information provided - GAM sets `range -30d today`
* Only `start <Time>` provided - GAM sets `end <Time>+30d`
* Only `end <Time>` provided - GAM sets `start <Time>-30d`
7.30.03
Updated `gam report <ActivityApplicationName>` to reflect the changes described here:

View File

@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
"""
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
__version__ = '7.30.03'
__version__ = '7.30.04'
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
#pylint: disable=wrong-import-position
@@ -14443,6 +14443,17 @@ def doReport():
else:
for eventName in eventNames:
zeroEventCounts[eventName] = 0
# gmail requires a start time and an end time no more than 30 days apart
if report == 'gmail':
if startEndTime.startTime is None:
if startEndTime.endTime is None:
startEndTime.endDateTime = todaysDate()
startEndTime.endTime = ISOformatTimeStamp(startEndTime.endDateTime)
startEndTime.startDateTime = startEndTime.endDateTime.shift(days=-30)
startEndTime.startTime = ISOformatTimeStamp(startEndTime.startDateTime)
elif startEndTime.endTime is None:
startEndTime.endDateTime = startEndTime.startDateTime.shift(days=30)
startEndTime.endTime = ISOformatTimeStamp(startEndTime.endDateTime)
i = 0
count = len(users)
for user in users: