Created by Microsoft Corporation, 2017. Provided As-is without warranty. Trademarks mentioned here are the property of their owners.
DEMO: http://onenoteapisamplenetcore.azurewebsites.net/
- This is a small sample that shows how to use the OneNote API from an ASP.NET server.
- It is configured to work for OneDrive only, but swapping AppIds/Auth urls would make it work with O365
Tools and Libraries you will need to download, install, and configure for your development environment
After you've set up your development tools, and installed the prerequisites listed above,...
- Download the repository as a ZIP file to your local computer, and extract the files. Or, clone the repository into a local copy of Git.
- Open the project (.sln file) in Visual Studio.
- It is highly recommended that you get your own client ID, secret and redirect uri and copy it into Config.cs You can get your own appid, app secret and redirect uri here
- Make a change to your machine (In windows, this is hosts file change) so the domain "onenoteapisamplenetcore.azurewebsites.net" (or the domain for the redirect URI you've chosen for your app) resolves to localhost or "127.0.0.1". Otherwise, authentication won't work.
- Make sure you have selected the "OneNoteApiSample" configuration when launching the app locally. See screenshot.
- Build and run the application (F5)
You can find additional documentation at the links below.
- Create Pages:
- Query and Search Pages:
- Manage Notebooks and Sections:
As a sample, and for simplicity, this sample does not follow best practices for an application in Production. If you intent to ship this code, we recommend doing the following:
-
Never check in app secrets to your repository
-
Require HTTPS throughout your site
-
Don't store unencrypted refresh tokens in cookies
-
NuGet packages used in the sample. These are handled using the package manager, as described in the setup instructions. These should update automatically at build time; if not, make sure your NuGet package manager is up-to-date. You can learn more about the packages we used at the links below.
- Newtonsoft Json.NET package provides Json parsing utilities.
- Other Nuget packages from Microsoft, listed in project.json
Date | Change |
---|---|
January 2017 | Initial public release for this code sample. |
- Visit the dev.onenote.com Dev Center
- Contact us on StackOverflow (tagged OneNote)
- Follow us on Twitter @onenotedev
- Read our OneNote Developer blog
- Explore the API using the apigee.com interactive console OR the apiary.io interactive console. Also, see the short overview/tutorial.
- API Reference documentation
- Debugging / Troubleshooting
- Getting Started with the OneNote service API
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments. \ No newline at end of file