Microsoft Office 365 Connect Sample for iOS Using Microsoft Graph (Swift)

Connecting to Microsoft Office 365 is the first step every iOS app must take to start working with Office 365 services and data. This sample shows how to connect and then call one API through Microsoft Graph.

Note: For the Objective-C version of this sample, see O365-iOS-Microsoft-Graph-Connect.

Prerequisites

Connect sample features

This sample demonstrates several REST calls to the Microsoft Graph REST endpoint.

Register and configure the app

  1. Open a browser and navigate to the Azure Active Directory admin center and login using a personal account (aka: Microsoft Account) or Work or School Account.

  2. Select Azure Active Directory in the left-hand navigation, then select App registrations under Manage.

  3. Select New registration. On the Register an application page, set the values as follows.

    • Set Name to Swift REST Connect Sample.
    • Set Supported account types to Accounts in any organizational directory and personal Microsoft accounts.
    • Under Redirect URI, change the drop down to Public client (mobile & desktop), and set the value to msauth.com.microsoft.O365-iOS-Microsoft-Graph-Connect-Swift-REST://auth.
  4. Choose Register. On the Swift REST Connect Sample page, copy the value of the Application (client) ID and save it, you will need it in the next step.

Update the sample with your client id

  1. Open O365-iOS-Microsoft-Graph-Connect-Swift.xcworkspace

  2. Open AuthenticationConstants.swift and replace <your-client-id> with the application ID you copied in the previous step.

  3. Run the sample.

Contributing

If you'd like to contribute to this sample, see CONTRIBUTING.MD.

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.

Questions and comments

We'd love to get your feedback about the Office 365 iOS Microsoft Graph Connect Swift project. You can send your questions and suggestions to us in the Issues section of this repository.

Questions about Microsoft Graph development in general should be posted to Stack Overflow. Make sure that your questions or comments are tagged with [MicrosoftGraph].

Copyright (c) 2017 Microsoft. All rights reserved.