Beyond the content that is stored in SharePoint, there is metadata and details about Assignments and Submissions that is stored for Assignments.
The export user data is supported for both Student and Teacher users. However, delete data is only supported for Students due to co-mingling and data retention compliance. Teachers can delete their data in app by deleting assignments / classes. For more information review the Assignments Admin documenatation.
There are three scripts to use depending upon the scenario:
Shared common step for Export and Delete user data scenario:
Use the Get-UserClasses.ps1 script to create a list of classes that user is part of. If the user has left the class, then a text file containing those class Ids can be provided to include data from those classes. Otherwise data will not be exported/deleted from those classes. Running this script will create a csv file that contains list of classes, role of user in class and whether export / delete for the user has been processed (false by default)
Exporting User data:
Use the Export-EDUAssignments.ps1 script to export data for the user. The csv file generated in the above step is input to this script. Running this script will get assignments and submissions of each assignment and generates two files. The assignment file (assignment.json) contains assignments and submissions and report file(GetAssignmentsReport.csv) - status of running the script. After running the script it updates the GetSubmissionsProcessed column in the csv input file to true for that specific class so that if there is a failure the script can be re-run.
Deleting User data:
Use the Delete-EDUAssignments.ps1 script to delete data for the user. The script reads the class details of user from input csv file generated in the shared step above. It then deletes the submissions, and generates a report file(DeleteAssignmentsReport.csv) for status of running the script. When the deletion of submission is done it updates the DeleteSubmissionsProcessed column to true for that specific class, so that if there is a failure the script can be re-run. The script will also remove students from the class unless optionally specified to not do so by the Tenant Admin, failing that the student will get all the assignments applicable to them be re-distributed to them.