Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

microsoftgraph/ios-objectivec-snippets-rest-sample

Repository files navigation

[ARCHIVED] Office 365 iOS Microsoft Graph Snippets

This project is being archived. As part of the archival process, we're closing all open issues and pull requests. For a current Objective-C sample, see ios-objectivec-connect-sample.

You can continue to use this sample "as-is", but it won't be maintained moving forward. We apologize for any inconvenience.

Introduction

Microsoft Graph (previously called Office 365 unified API) exposes multiple APIs from Microsoft cloud services through a single REST API endpoint. This repository shows you how to access multiple resources, including Microsoft Azure Active Directory (AD) and the Office 365 APIs, by making HTTP requests to the Microsoft Graph API in an iOS application.

Prerequisites

  • Xcode from Apple

  • Installation of CocoaPods as a dependency manager.

  • An Office 365 account. You can sign up for an Office 365 Developer subscription that includes the resources that you need to start building Office 365 apps.

    Note: If you already have a subscription, the previous link sends you to a page with the message Sorry, you can’t add that to your current account. In that case, use an account from your current Office 365 subscription.

  • A Microsoft Azure tenant to register your application. Azure AD provides identity services that applications use for authentication and authorization. A trial subscription can be acquired here: Microsoft Azure.

    Important: You will also need to ensure your Azure subscription is bound to your Office 365 tenant. To do this see the Active Directory team's blog post, Creating and Managing Multiple Windows Azure Active Directories. The section Adding a new directory will explain how to do this. You can also see Set up your Office 365 development environment and the section Associate your Office 365 account with Azure AD to create and manage apps for more information.

Running this sample in Xcode

  1. Clone this repository

  2. Use CocoaPods to import the necessary dependencies:

      pod 'AFNetworking', '2.6.0'
      pod 'ADALiOS', '1.2.4'
    

    This sample app already contains a podfile that will get the necessary components(pods) into the project. Simply navigate to the project from Terminal and run

     pod install
    

    For more information, see Using CocoaPods in Additional Resources

  3. Open O365-iOS-Microsoft-Graph-Snippets.xcworkspace

  4. Open ConnectViewController.m under the Controllers folder in the project. Ensure you have registered your app in Microsoft Azure, configured the proper permissions as specified, and obtained the ClientID (application id) and RedirectUri values from the registration. Again, this procedure is detailed under the fifth bullet point in the prerequisites section: A client id and redirect uri values of an application registered in Azure. You'll see that the ClientID and RedirectUri values can be added to the top of the file. Supply the necessary values here:

     // You will set your application's clientId and redirect URI. You get
     // these when you register your application in Microsoft Azure.
     NSString * const kRedirectUri = @"ENTER_REDIRECT_URI_HERE";
     NSString * const kClientId    = @"ENTER_CLIENT_ID_HERE";
     NSString * const kResourceId  = @"https://graph.microsoft.com";
     NSString * const kAuthority   = @"https://login.microsoftonline.com/common";
    

5.Run the sample

To learn more about the sample, visit our understanding the code wiki page.

Questions and comments

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

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

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 CLA when you receive the email containing the link to the document.

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.

Additional resources

Copyright

Copyright (c) 2015 Microsoft. All rights reserved.

About

This sample shows how to use Microsoft Graph to send email, manage groups, and perform other activities with Office 365 data.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published