Hi - we ended up having to write a patch to the PHP code directly. We've sent this to GitHub. Will paste our solution here but check the github post in case there are updates or additional suggestions:
https://github.com/microsoft/o365-moodle/issues/1222
____________________________________________________________________
We've found a resolution to auto-populate the teams. Have to read on on how to suggest formal code changes but wanted to share our patch to help other Education organizations get up and running. Any suggestions on making this code patch better welcomed!
The function that finds groups without associated teams does not first create the o365 group and then the corresponding Team. By adding a o365 group creation step to the PHP code, it will create the missing groups. This happens almost instantly once the code change is made.
We've also used the prefix rule in the code so the o365 groups will all start with "M: Course Short Name" to differentiate them from other groups/teams.
PHP Code from Office 365 Integration 3.8.0.1 2020020301 Package local_o365
File Path: moodle\local\o365\classes\feature\usergroups\coursegroups.php
Function: public function create_groups_for_new_courses()
Updated/Added Group Naming Convention (exists currently line 62):
Original: $groupprefix = '';
New: $groupprefix = 'M';
After it runs the query to "Process courses without an associated group", there is a routine that tries to create the team then creates the group if that fails. Right now that isn't working and we didn't look at why but instead we try to always create the group first then try to create the team to hopefully always create both regardless.
The main patch is to replace the following code currently at line 135 quoted here with code that has an additional group create before trying to create the team.
OLD CODE:
if ($createclassteam) {
// Create class team directly.
try {
$objectrec = $this->create_class_team($course, $ownerids, $groupprefix);
} catch (\Exception $e) {
$this->mtrace('Could not create class team for course #' . $course->id . '. Reason: ' . $e->getMessage());
continue;
}
} else {
// Create group.
try {
$objectrec = $this->create_group($course, $groupprefix);
} catch (\Exception $e) {
$this->mtrace('Could not create group for course #'.$course->id.'. Reason: '.$e->getMessage());
continue;
}
}
NEW CODE:
// MANUAL CODE PATCH STARTS: First Create group
$this->mtrace('PATCHED: First trying to create group: '.$course->shortname);
try {
$objectrec = $this->create_group($course, $groupprefix);
} catch (\Exception $e) {
$this->mtrace('Could not create group for course #'.$course->shortname.'. Reason: '.$e->getMessage());
continue;
}
// MANUAL CODE PATCH ENDS
if ($createclassteam) {
// Create class team directly.
try {
$objectrec = $this->create_class_team($course, $ownerids, $groupprefix);
} catch (\Exception $e) {
$this->mtrace('Could not create class team for course #' . $course->id . '. Reason: ' . $e->getMessage());
continue;
}
} else {
// Create group.
try {
$objectrec = $this->create_group($course, $groupprefix);
} catch (\Exception $e) {
$this->mtrace('Could not create group for course #'.$course->id.'. Reason: '.$e->getMessage());
continue;
}
}