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.
- Xcode version 10.2.1
- CocoaPods
- 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.
This sample demonstrates several REST calls to the Microsoft Graph REST endpoint.
- GETs the signed in user's profile photo from the user endpoint.
- PUT request to upload the profile photo to the user's OneDrive root folder
- POST a request to OneDrive to create a sharing link for a drive item to give other user's access to the uploaded photo
- POSTS a request to send a mail message with a photo attachment
-
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.
-
Select Azure Active Directory in the left-hand navigation, then select App registrations under Manage.
-
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
.
- Set Name to
-
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.
-
Open O365-iOS-Microsoft-Graph-Connect-Swift.xcworkspace
-
Open AuthenticationConstants.swift and replace
<your-client-id>
with the application ID you copied in the previous step. -
Run the sample.
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.
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.