OneNote service API ASP.NET core sample

Created by Microsoft Corporation, 2017. Provided As-is without warranty. Trademarks mentioned here are the property of their owners.

DEMO: https://onenoteapisamplegraph.azurewebsites.net

Intro

  • This is a small sample that shows how to use access OneNote resources via the Microsoft Graph API from an ASP.NET server.

Prerequisites

Tools and Libraries you will need to download, install, and configure for your development environment

Using the sample

After you've set up your development tools, and installed the prerequisites listed above,...

  1. 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.
  2. Open the project (.sln file) in Visual Studio.
  3. 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
  4. For local development, the sample uses http://localhost:5001/msgraphoauthcallback as a redirect URI. For production, you should change this to point to your application's domain. >Note: Chrome and Firefox do not allow cookies to be set on localhost, and thus authentication will not work on these browsers during development if you choose to redirect to localhost.
  5. Make sure you have selected the "OneNoteApiSample" configuration when launching the app locally. See screenshot.
  6. Build and run the application (F5)

Content

You can find additional documentation at the links below.

Note

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.

Version Info

Date Change
May 2017 Updated to utilize the Microsoft Graph v1.0 base URL for OneNote resources
March 2017 Updated to utilize the Microsoft Graph API endpoints.
January 2017 Initial public release for this code sample.

Learning More

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.