How to use Graph API to get the OneNotes of a private teams channel?

Gary Schellhas 0 Reputation points
2023-07-18T14:01:16.64+00:00

Using the https://graph.microsoft.com/v1.0/groups/{id}/onenote/notebooks graph api endpoint, I can get all of the oneNotes of the team, but it does not show any oneNotes from private channels.

Also trying the https://graph.microsoft.com/v1.0/sites/{id}/onenote/notebooks api but it always returns ,

"message": "The OData query is invalid. The URI segment 'notebooks' is invalid after the segment 'notes'."

Is there another endpoint or specific group I should be looking at to get the oneNotes for the private channel?

My end goal is to be able to copy the oneNote from one channel to another.

Microsoft Teams | Development
Microsoft Security | Microsoft Graph
Microsoft 365 and Office | OneNote | For business | Windows
Microsoft Teams | Microsoft Teams for business | Other
{count} votes

2 answers

Sort by: Most helpful
  1. msft-gu 1,355 Reputation points
    2023-07-18T17:58:35.51+00:00

    Hi @Gary Schellhas ,

    Good afternoon and thank you for your question. I was able to use https://graph.microsoft.com/v1.0/sites/{id}/onenote/notebooks on Graph Explorer and the OneNote Notebook under the Private Channel was showing. Make sure that you are using the ID of the Private Channel.

    What I did was:

    To add about the move, I only saw copy under the OneNote Notebooks:

    Reference: https://learn.microsoft.com/en-us/graph/api/notebook-copynotebook?view=graph-rest-1.0&tabs=http

    1 person found this answer helpful.
    0 comments No comments

  2. Prasad-MSFT 8,981 Reputation points Microsoft External Staff Moderator
    2023-07-20T04:50:03.0266667+00:00

    Site Id has to be specified in 3 parts (separated by commas) like the format shown in below document.
    See the documentation at: https://learn.microsoft.com/en-us/graph/api/site-get?view=graph-rest-1.0

    This is what i tried from my end:
    Step 1: GET https://graph.microsoft.com/v1.0/sites?search=private
    User's image

    Step 2: GEThttps://graph.microsoft.com/v1.0/sites/{id}/onenote/notebooks
    User's image

    Thanks, 

    Prasad Das

    ************************************************************************* 

    If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.