[ARCHIVED] Microsoft Graph Connect Sample for UWP (REST)
This project is being archived and replaced with the Build UWP apps with Microsoft Graph. As part of the archival process, we're closing all open issues and pull requests.
You can continue to use this sample "as-is", but it won't be maintained moving forward. We apologize for any inconvenience.
Building apps for enterprise customers? Your app may not work if your enterprise customer turns on enterprise mobility security features like conditional device access. In this case, you may not know and your customers may experience errors.
To support all enterprise customers across all enterprise scenarios, you must use the Azure AD endpoint and manage your apps using the Azure Management Portal. For more information, see Deciding between the Azure AD and Azure AD v2.0 endpoints.
Important Note about the MSAL Preview
This library is suitable for use in a production environment. We provide the same production level support for this library as we do our current production libraries. During the preview we may make changes to the API, internal cache format, and other mechanisms of this library, which you will be required to take along with bug fixes or feature improvements. This may impact your application. For instance, a change to the cache format may impact your users, such as requiring them to sign in again. An API change may require you to update your code. When we provide the General Availability release we will require you to update to the General Availability version within six months, as applications written using a preview version of library may no longer work.
Table of contents
- Register and configure the app
- Build and debug
- Questions and comments
- Additional resources
This sample shows how to connect your Windows 10 Universal app to Office 365 using the Microsoft Graph API to retrieve a user's profile picture, upload the picture to OneDrive, and send an email that contains the photo as an attachment and the sharing link in its text. The sample uses the Azure AD v2.0 endpoint, which enables users to sign in with either their personal or work or school Microsoft accounts.
Note: To understand the code for calling Microsoft Graph in a UWP app, see Get started with Microsoft Graph in a universal Windows 10 app.
Note: Try out the Get started with Office 365 APIs page, which simplifies registration so you can get this sample running faster.
This sample requires the following:
- Visual Studio 2015
- Windows 10 (development mode enabled)
- Either a Microsoft or Office 365 for business account.
Register and configure the app
Sign into the App Registration Portal using either your personal or work or school account.
Select Add an app.
Enter a name for the app, and select Create application.
The registration page displays, listing the properties of your app.
Under Platforms, select Add platform.
Select Native Application.
Copy both the Application Id and Redirect URI values to the clipboard. You'll need to enter these values into the sample app.
The app id is a unique identifier for your app. The redirect URI is a unique URI provided by Windows 10 for each application to ensure that messages sent to that URI are only sent to that application.
Build and debug
Note: If you see any errors while installing packages during step 2, make sure the local path where you placed the solution is not too long/deep. Moving the solution closer to the root of your drive resolves this issue.
After you've loaded the solution in Visual Studio, configure the sample to use the application (client) id and redirectURI that you registered by adding the corresponding values for these keys in the Application.Resources node of the App.xaml file. `
Press F5 to build and debug. Run the solution and sign in with either your personal or work or school account.
If you'd like to contribute to this sample, see CONTRIBUTING.MD.
Questions and comments
We'd love to get your feedback about the UWP Microsoft Graph Connect project. You can send your questions and suggestions to us in the Issues section of this repository.
Your feedback is important to us. Connect with us on Stack Overflow. Tag your questions with [MicrosoftGraph] and [office365].
- Other Office 365 Connect samples
- Microsoft Graph overview
- Office 365 APIs platform overview
- Office 365 API code samples and videos
- Office developer code samples
- Office dev center
Copyright (c) 2017 Microsoft. All rights reserved.