OfficeDev/OneNote-SDK-iOS

Name: OneNote-SDK-iOS

Owner: Office Developer

Description: null

Created: 2015-11-12 21:03:05.0

Updated: 2017-11-03 03:17:12.0

Pushed: 2017-12-28 21:33:36.0

Homepage: null

Size: 125

Language: Objective-C

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

OneNote SDK for iOS (Preview)

Important: This preview SDK has been deprecated and is no longer being maintained. We recommend that you use Microsoft Graph and the associated Microsoft Graph SDKs instead.

Easily integrate services and data from OneNote into native iOS apps using this Objective-C library.


:exclamation:NOTE: This code and associated binaries are released as a developer PREVIEW. You are free to use this library according to the terms of its included LICENSE and to open issues in this repo for unofficial support.

Information about official Microsoft support is available here.


This library is generated from the OneNote API metadata using Vipr and Vipr-T4TemplateWriter and uses a shared client stack.

Quick Start

To use this library in your project, follow these general steps, as described further below:

  1. Configure a Podfile.
  2. Set up authentication.
  3. Construct an API client.
Setup
  1. Create a new Xcode application project from the Xcode splash screen. In the dialog, choose iOS > Single View Application. Name your application as you wish; we'll assume the name OneNoteQuickStart here.

  2. Add a file to the project. Choose iOS > Other > Empty from the dialog and name your file Podfile.

  3. Add these lines to the Podfile to import the OneNote SDK

    ce 'https://github.com/CocoaPods/Specs.git'
    eproj 'OneNoteQuickStart'
    'MSOneNote-SDK-iOS'
    

    NOTE: For detailed information on Cocoapods and best practices for Podfiles, read the Using Cocoapods guide.

  4. Close the Xcode project.

  5. From the command line, change to your project's directory. Then run pod install.

    NOTE: Install Cocoapods first of course. Instructions here.

  6. From the same location in the terminal, execute open OneNoteQuickStart.xcworkspace to open a workspace containing your original project together with imported pods in Xcode.


Authenticate and construct client

With your project prepared, the next step is to initialize the dependency manager and an API client.

:exclamation: If you haven't yet registered your app in Azure AD, you'll need to do so before completing this step by following these instructions.

  1. Right-click the OneNoteQuickStart folder and choose “New File.” In the dialog, select iOS > Resource > Property List. Name the file adal_settings.plist. Add the following keys to the list and set their values to those from your app registration. These are just examples; be sure to use your own values.

    |Key|Value| |—|—–| |ClientId|Example: e59f95f8-7957-4c2e-8922-c1f27e1f14e0| |RedirectUri|Example: https://my.client.app/| |ResourceId|Example: https://www.onenote.com/api| |AuthorityUrl|https://login.microsoftonline.com/common/|

  2. Open ViewController.m from the OneNoteQuickStart folder. Add the umbrella header for OneNote and ADAL related headers.

    ort <MSOneNoteApi.h>
    ort <impl/ADALDependencyResolver.h>
    ort <ADAuthenticationResult.h>
    
  3. Add properties for the ADALDependencyResolver and MSOneNoteApi in the class extension section of ViewController.m.

    erface ViewController ()
    
    perty (strong, nonatomic) ADALDependencyResolver *resolver;
    perty (strong, nonatomic) MSOneNoteApi *oneNoteClient;
    
    
    
  4. Initialize the resolver and client within the viewDidLoad method of the ViewController.m file.

  5. (void)viewDidLoad { [super viewDidLoad];

    self.resolver = [[ADALDependencyResolver alloc] initWithPlist];

    self.oneNoteClient = [[MSOneNoteApi alloc] initWithUrl:@“https://www.onenote.com/api/beta/” dependencyResolver:self.resolver]; }

  6. Before using the client, you must ensure the user has been logged on interactively at least once. You can use either interactiveLogon or interactiveLogonWithCallback: to initiate the logon sequence. In this exercise, add the following to the viewDidLoad method from the last step:

    f.resolver interactiveLogonWithCallback:^(ADAuthenticationResult *result) {
    (result.status == AD_SUCCEEDED) {
     [self.resolver.logger logMessage:@"Connected." withLevel:LOG_LEVEL_INFO];
    lse {
     [self.resolver.logger logMessage:@"Authentication failed." withLevel:LOG_LEVEL_ERROR];
    
    
    
  7. Now you can safely use the API client.

Samples
Contributing

You will need to sign a Contributor License Agreement before submitting your pull request. To complete the Contributor License Agreement (CLA), you will need to submit a request via the form and then electronically sign the Contributor License Agreement when you receive the email containing the link to the document. This needs to only be done once for any Microsoft Open Technologies OSS project.

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.

License

Copyright (c) Microsoft, Inc. All rights reserved. Licensed under the Apache License, Version 2.0.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.