Saturday, May 1, 2021

Change permissions of a class notebook

When a teacher leaves the school, or changes classes, it is common for the need to transfer one or more class notebooks from the old teacher to the new teacher. This script will allow the IT Admin to copy all of the Class Notebook contents of the old teacher's OneDrive over to the new teacher's OneDrive. The script will also re-trigger the provisioning and permissioning API's to ensure that the class notebook in the new location is properly set up, and all of the contents of the Collaboration Space, Content Library and Student Notebooks are properly set up. In addition, an email will be sent to all students in the class with a link to open the notebook in the new teacher's OneDrive location.

The following aspects of the API are covered in this sample. Obtain an access token using Azure PowerShell POST a Class Notebook Transfer

Azure PowerShell - used to obtain an access token to talk to the OneNote Class Notebooks API. Two Microsoft 365 account with OneDrive set up - This sample will transfer a notebook located on a teacher's OneDrive and transfer it to the other teacher's OneDrive. To ensure that your OneDrive is set up, log on to Microsoft 365 and click the blue "OneDrive" icon in the app launcher. If you are taken to your OneDrive, you are all set. OneNote Class Notebook created using our OneNote Class Notebooks API - this is the notebook the sample will transfer between the teachers.

Change permissions

  1. Obtain a client ID as described under Authenticate using Azure AD (enterprise apps). When asked for a redirect URI, "http://localhost" will suffice:

  2. Download this repo as a ZIP file to your local computer, and extract the files. Or, clone the repository into a local copy of Git.

    Add an indented paragraph under a numbered step by placing cursor before the /para tag, then press Enter.

  3. Edit OneNoteClassNotebooksApiSample.ps1. Find and replace the following tokens with real values:

    <AZURE_AD_TENANT_NAME> - This is your Microsoft 365 tenant, e.g. "contoso.com".

    <CLIENT_ID> - This is the client ID of your app, e.g. "471afe29-4aee-4bc5-9aaf-468ee5bbe20a".

    <MY_ADMIN_LOGIN> - This is your IT Admin Microsoft 365 login name.

    <MY_ADMIN_PASSWORD> - This is your IT Admin Microsoft 365 password.

    <NOTEBOOK_ID> - This is the Id of the notebook to be transferred.

    <SOURCE_TEACHER_ID> - This is the login name of the original teacher that owns the notebook.

    <DESTINATION_TEACHER_ID> - This is the login name of the new teacher that will receive the notebook.

  4. Once all the placeholders above have been replaced with real values (remember to enclose each value in double quotes), simply execute the script.

  5. Once the script has successfully executed, you will receive a string containing the correlation number. Please keep this as it may help us investigate if there is any issue with the transfer.

  6. Go to the destination teacher OneDrive where you will see a folder named "Class Notebooks". In this folder you will find the class notebook the script transfered from the source's teacher. This process may take a few minutes.

No comments:

Post a Comment