Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

OneNoteDev/ClassNotebookTransferAPISample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

OneNote API Class Notebooks Transfer PowerShell Sample README

Created by Microsoft Corporation, 2016. Provided as-is without warranty. Trademarks mentioned here are the property of their owners.

Scenario

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 apis 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.

API functionality demonstrated in this sample

The following aspects of the API are covered in this sample.

  • Obtain an access token using Azure PowerShell
  • POST a Class Notebook Transfer

Prerequisites

  • Azure PowerShell - used to obtain an access token to talk to the OneNote Class Notebooks API.
  • Two Office 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 Office 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.

Using the sample

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

Image of redirect URI

When asked for OneNote delegated permissions, check the following:

Image of permissions

  1. 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.

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

    • <AZURE_AD_TENANT_NAME> - This is your Office 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 Office 365 login name.
    • <MY_ADMIN_PASSWORD> - This is your IT Admin Office 365 password.
    • <NOTEBOOK_ID> - This is the Id of the notebook to be transfered.
    • <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.
  3. Once all the placeholders above have been replaced with real values (remember to enclose each value in double quotes), simply execute the script.

  4. 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.

  5. 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.

Version info

This is the initial public release for this code sample.

Learning more

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

About

Code sample of how to use the OneNote API to transfer a Class Notebook on PowerShell

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published