Skip to main content

onenote notebook add

Create a new OneNote notebook.

Usage

m365 onenote notebook add [options]

Options

-n, --name <name>

Name of the notebook. Notebook names must be unique. The name cannot contain more than 128 characters or contain the following characters: ?*/:<>

--userId [userId]

Id of the user. Specify either userId, userName, groupId, groupName or webUrl, but not multiple.

--userName [userName]

Name of the user. Specify either userId, userName, groupId, groupName or webUrl, but not multiple.

--groupId [groupId]

Id of the SharePoint group. Specify either userId, userName, groupId, groupName or webUrl, but not multiple.

--groupName [groupName]

Name of the SharePoint group. Specify either userId, userName, groupId, groupName or webUrl, but not multiple.

-u, --webUrl [webUrl]

URL of the SharePoint site. Specify either userId, userName, groupId, groupName or webUrl, but not multiple.

-h, --help [help]

Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, response, full. Default is options.

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.

--verbose

Runs command with verbose logging.

--debug

Runs command with debug logging.

Examples

Create a Microsoft OneNote notebook for the currently logged in user

m365 onenote notebook add --name "Private Notebook"

Create a Microsoft OneNote notebook in a group specified by id.

m365 onenote notebook add --name "Private Notebook" --groupId 233e43d0-dc6a-482e-9b4e-0de7a7bce9b4

Create a Microsoft OneNote notebook in a group specified by displayName.

m365 onenote notebook add --name "Private Notebook" --groupName "MyGroup"

Create a Microsoft OneNote notebook for a user specified by name

m365 onenote notebook add --name "Private Notebook" --userName user1@contoso.onmicrosoft.com

Create a Microsoft OneNote notebook for a user specified by id

m365 onenote notebook add --name "Private Notebook" --userId 2609af39-7775-4f94-a3dc-0dd67657e900

Creates a Microsoft OneNote notebooks for a site

 m365 onenote notebook add --name "Private Notebook" --webUrl https://contoso.sharepoint.com/sites/testsite

Response

{
"id": "1-08554ffd-b769-4a4a-9563-faaa3191f253",
"self": "https://graph.microsoft.com/v1.0/users/fe36f75e-c103-410b-a18a-2bf6df06ac3a/onenote/notebooks/1-08554ffd-b769-4a4a-9563-faaa3191f253",
"createdDateTime": "2024-04-05T17:58:27Z",
"displayName": "Private Notebook",
"lastModifiedDateTime": "2024-04-05T17:58:27Z",
"isDefault": false,
"userRole": "Owner",
"isShared": false,
"sectionsUrl": "https://graph.microsoft.com/v1.0/users/fe36f75e-c103-410b-a18a-2bf6df06ac3a/onenote/notebooks/1-08554ffd-b769-4a4a-9563-faaa3191f253/sections",
"sectionGroupsUrl": "https://graph.microsoft.com/v1.0/users/fe36f75e-c103-410b-a18a-2bf6df06ac3a/onenote/notebooks/1-08554ffd-b769-4a4a-9563-faaa3191f253/sectionGroups",
"createdBy": {
"user": {
"id": "fe36f75e-c103-410b-a18a-2bf6df06ac3a",
"displayName": "John Doe"
}
},
"lastModifiedBy": {
"user": {
"id": "fe36f75e-c103-410b-a18a-2bf6df06ac3a",
"displayName": "John Doe"
}
},
"links": {
"oneNoteClientUrl": {
"href": "onenote:https://contoso-my.sharepoint.com/personal/john_contoso_onmicrosoft_com/Documents/Notebooks/Private Notebook"
},
"oneNoteWebUrl": {
"href": "https://contoso-my.sharepoint.com/personal/john_contoso_onmicrosoft_com/Documents/Notebooks/Private Notebook"
}
}
}
CTRL + M