Automate OneNote Class Notebook creation and roster changes with new APIs

We are excited to announce the launch of the new OneNote Class Notebook API for Office 365! Since the launch of OneNote Class Notebooks last year, the only way to create Class Notebooks was through the OneNote Class Notebooks Office 365 app. Thanks to all the feedback we’ve received from teachers and IT admins, we made it possible to now create OneNote Class Notebooks programmatically as well. What this means is that IT admins, Microsoft Education Partners and others can automate the creation and updates of OneNote Class Notebooks across a school or district. This allows for large time savings and efficiency for teachers, as well as school IT staff.

Read the MSDN article on the OneNote Class Notebook API for in-depth instructions.

What does the API do?

Anyone familiar with the existing OneNote API for Office 365 will find themselves right at home with the OneNote Class Notebooks API for Office 365. Like the OneNote Class Notebooks Office 365 app, the only requirement for teachers is that they have an Office 365 faculty license and their OneDrive for Business is set up.

But how does this API help me, you ask? Suppose you are the IT admin of your school. Wouldn’t it be great if teachers came in on the first day of the new semester and found that a OneNote Class Notebook has been created for all of their classes and with all of their students? With the new OneNote Class Notebooks API, you can do just that! If you have the rosters of your teachers handy (perhaps you pulled it from your school’s SIS or it’s stored in an Excel/CSV file), all you need is a simple script that calls the OneNote Class Notebooks API to create OneNote Class Notebooks for every teacher:

POST https://www.onenote.com/api/v1.0/users/<teacher_id>/notes/classnotebooks

{
        name: "Math 101",
        studentSections: [ 
            "Homework", 
            "Class Notes", 
            "Handouts", 
            "Quizzes" 
        ],
        teachers: [
                {
                    id: "abigail.johnson@contoso.com",
                    principalType: "Person"
                }
        ],
        students: [
                {
                    id: "michael.lee@contoso.com",
                    principalType: "Person"
                },
                {
                    id: "amanda.sullivan@contoso.com",
                    principalType: "Person"
                },
                {
                    id: "benjamin.hall@contoso.com",
                    principalType: "Person"
                }
        ]
}

As every teacher and IT admin will tell you, students change classes all the time during the first few weeks of every year or semester. With the new OneNote Class Notebooks API, moving a student from one Class Notebook to another is as simple as:

DELETE https://www.onenote.com/api/v1.0/users/<teacher_id>/notes/classnotebooks/<old_notebook_id>/students/<student_id>

to remove the student from their old Class Notebook, followed by:

POST https://www.onenote.com/api/v1.0/users/<teacher_id>/notes/classnotebooks/<new_notebook_id>/students 

{
        id: "michael.lee@contoso.com",
        principalType: "Person"
}

to add the student to their new Class Notebook.

And finally, no API is complete without the ability to retrieve existing data. An IT admin can retrieve the OneNote Class Notebooks for a particular teacher by calling:

GET https://www.onenote.com/api/v1.0/users/<teacher_id>/notes/classnotebooks

Retrieving students and teachers for a particular OneNote Class Notebook is done in a similar fashion:

GET https://www.onenote.com/api/v1.0/users/<teacher_id>/notes/classnotebooks/<notebook_id>/students
GET https://www.onenote.com/api/v1.0/users/<teacher_id>/notes/classnotebooks/<notebook_id>/teachers

Partner opportunities

With these new APIs, we envision lots of new ideas and solutions built by our Microsoft Education Partners. We have heard a strong demand for new tools and solutions to help schools roll out OneNote Class Notebooks, and our partners have expressed a desire to help provide these. Head over to GitHub for sample code to get started.

Send us your feedback

We’d love to hear from you any suggestions or questions you might have. Simply drop us a line at onenoteedu@microsoft.com.