Error deleting a student from OneNote classnotebook using API RRS feed

  • Question

  • I am trying to delete a student from a OneNote classnote book using the microsoft onenote API, but getting the following error.

    {'error': {'code': '19999', 'message': 'Something failed, the API cannot share any more information at the time of the request.', '@api.url': ''}}

    I am using the REST API command documented here

    There isn't a graph API REST call, MS haven't provided any class notebook calls in graph, and the current graph documentation points to the above documentation for dealing with class notebooks.

    Here is my python code

    onenote_url = ''
    def remove_student_from_notebook( token , studentid , notebookid ):
        client = OAuth2Session(token=token)  
        headers = { 'Authorization': 'Bearer, {}'.format(token), 'Accept': 'application/json' }  
        url = '{0}/classNotebooks/{1}/students/{2}'.format(onenote_url,notebookid,studentid)  
        events = client.delete(url, headers=headers )  
        print( events.json() )

    I know the ids are correct because I can use the exact same ones to add a student to the class notebook without any problems.

    Has anyone got this API to work?

    What am I doing wrong?

    Sunday, January 26, 2020 9:29 AM

All replies

  • I have found the problem. I was using the principleUserName because it is what is returned by a previous API call to get the list of students in a class notebook.

    In my case for some reason the principleUserName is something like 


    which has special characters so can't form part of the URL the REST API call.

    The solution is to strip of the first part of the principleUserName and only use the email address i.e., then it works.

    BTW adding a student works because the principleUserName is sent as json data to that API call and not encoded in the URL.

    • Edited by eduwaller Monday, January 27, 2020 1:28 PM
    Monday, January 27, 2020 1:21 PM