To delete a notebook from OneNote, you can use the PowerShell cmdlet Remove-MgUserOnenoteNotebook if you are working with the Microsoft Graph API. Here’s how you can do it:
- Open PowerShell: Make sure you have the Microsoft.Graph.Notes module installed.
- Use the cmdlet: Execute the following command:
ReplaceRemove-MgUserOnenoteNotebook -NotebookId <NotebookId> -UserId <UserId><NotebookId>with the unique identifier of the notebook you want to delete and<UserId>with the unique identifier of the user. - Confirm the deletion: You may need to confirm the action depending on the parameters you set.
If you are using the beta version, you can use Remove-MgBetaUserOnenoteNotebook with similar parameters.
Make sure to check if you have the necessary permissions to delete notebooks, as this may affect your ability to perform the action.